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

2011-02-25 Thread David Winsemius


On Feb 24, 2011, at 3:38 PM, Kent Alleman wrote:


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.


lstnames <- paste("subset", 1:2, sep="_")
names(Lst) <- lstnames



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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


David Winsemius, MD
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


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

2011-02-24 Thread Kent Alleman
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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.