Re: [R] Dynamically build variable names

2010-05-17 Thread Henrik Bengtsson
On Mon, May 17, 2010 at 11:12 AM, jim holtman wrote: > ?'[[' > > What I think you want is: > > x <- "V1_1" > mean(l[[x]]) > > Also you need to look at 'get'. ...and if the answer is get() or assign() you should usually consider library("fortunes"); fortune("rethink the question"); /Henrik > > O

Re: [R] Dynamically build variable names

2010-05-17 Thread jim holtman
?'[[' What I think you want is: x <- "V1_1" mean(l[[x]]) Also you need to look at 'get'. On Mon, May 17, 2010 at 4:41 AM, Stefan Petersson < stefan.peters...@inizio.se> wrote: > > I'm trying to dynamically build variable names to use on a list. Let's say > I have a list like this one: > > l <-

Re: [R] Dynamically build variable names

2010-05-17 Thread Stefan Petersson
> > > I'm trying to dynamically build variable names to use on a list. Let's say I have a list like this one: > > l <- list(V1_1=c(1,2,3), V1_2=c('One','Two','Three')) > > And I succesfully build my variable name like this: > > paste('l$', 'V1_1', sep='') > > Why can't I just run a mean call

Re: [R] Dynamically build variable names

2010-05-17 Thread jim holtman
> library(fortunes) > fortune('parse') If the answer is parse() you should usually rethink the question. -- Thomas Lumley R-help (February 2005) > On Mon, May 17, 2010 at 5:08 AM, Stefan Petersson < stefan.peters...@inizio.se> wrote: > > > > > > I'm trying to dynamically build variabl

[R] Dynamically build variable names

2010-05-17 Thread Stefan Petersson
I'm trying to dynamically build variable names to use on a list. Let's say I have a list like this one: l <- list(V1_1=c(1,2,3), V1_2=c('One','Two','Three')) And I succesfully build my variable name like this: paste('l$', 'V1_1', sep='') Why can't I just run a mean call with the pasted variab