Skip to content

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

2 messages · Kent Alleman, David Winsemius

#
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:
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
#
On Feb 24, 2011, at 3:38 PM, Kent Alleman wrote:

            
lstnames <- paste("subset", 1:2, sep="_")
names(Lst) <- lstnames
David Winsemius, MD
West Hartford, CT