[R] Creating objects (data.frames) with names stored in character vector

Kent Alleman ksalleman at yahoo.com
Thu Feb 24 21:38:27 CET 2011


Hello,

I'm fairly new to R.  I'm a chemist, not a programmer so please bear with me.

I have a large data.frame that I want to break down (subset) into smaller data.frames for analysis.  I would like to give the data.frames descriptive names which I have stored in a character vector.  My original thought was that I want the subsets to show up as individual objects, but haveing them stored in a list is fine (maybe better).

I can create a list of subsetted data.frames like this:

>Lst = list(subset1 = (subset (blablabla)), subset2 = (subset(blabla)))
but I have to provide the component names (subset1, subset2) manually.

I would like to pull the component names from an existing character vector, but so far my attempts have failed.

Any advice is appreciated, even if the advice is "don't do that."

Thank you,

Kent



More information about the R-help mailing list