Re: [R] column selection in list

2010-01-25 Thread Adaikalavan Ramasamy
If the columns of all elements of the list are in the same order, then you can collapse it first and then extract. out <- do.call("rbind", SPECSHOR_tx_Asfc) out[ , "Asfc.median"] Regards, Adai Ivan Calandra wrote: Hi everybody! I have a (stupid) question but I cannot find a way to do

Re: [R] column selection in list

2010-01-25 Thread Ivan Calandra
Thanks, I didn't think about the help for such a character. Ivan Le 1/22/2010 18:50, baptiste auguie a écrit : ?"[" should give you enough information. In short, "[" is an operator to extract elements, you can think of it as a function with special semantics. For a simple vector, v = c("one", "

Re: [R] column selection in list

2010-01-22 Thread baptiste auguie
?"[" should give you enough information. In short, "[" is an operator to extract elements, you can think of it as a function with special semantics. For a simple vector, v = c("one", "two") v[2] selects the second element of the vector, and is equivalent to, `[`(v, 2) # "two" as you can see fro

Re: [R] column selection in list

2010-01-22 Thread Ivan Calandra
Thanks Baptiste, it does help. However, I don't really understand what "[" means. Could you please tell me more about it? I didn't find anything helpful on that in the help. Thanks in advance Ivan Le 1/22/2010 17:19, baptiste auguie a écrit : Hi, Try this, a = replicate(3, data.frame(x=1

Re: [R] column selection in list

2010-01-22 Thread baptiste auguie
Hi, Try this, a = replicate(3, data.frame(x=1:10, y=rnorm(10)), simplify=FALSE) lapply(a, "[", "y") HTH, baptiste 2010/1/22 Ivan Calandra : > Hi everybody! > > I have a (stupid) question but I cannot find a way to do it! > > I have a list like: >> SPECSHOR_tx_Asfc > $cotau >   SPECSHOR Asfc.m

[R] column selection in list

2010-01-22 Thread Ivan Calandra
Hi everybody! I have a (stupid) question but I cannot find a way to do it! I have a list like: > SPECSHOR_tx_Asfc $cotau SPECSHOR Asfc.median 38cotau381.0247 39cotau154.6280 40cotau303.3219 41cotau351.2933 42cotau156.5327 $eqgre SPECSHOR Asfc.median