Re: [R] extracting row means from a list

From: Liaw, Andy <andy_liaw_at_merck.com>
Date: Wed 20 Jul 2005 - 08:24:56 EST


Justone more comment in addition to Sundar's solution:

If these are all numeric matrices, I would read them into R as such, instead of data frames. Actually, I would read them all into a 3-dimensional array (2000 x 6 x # of files). Assuming you have such an array, then you can do something like:

> ## get your example into an array: need the abind package.
> bar <- do.call("abind", c(lapply(foo, as.matrix), along=3))
> str(bar)

 num [1:100, 1:6, 1:10] -0.78981 0.31939 -0.00819 1.59346 1.20498 ...

Andy

> -----Original Message-----
> From: r-help-bounces@stat.math.ethz.ch
> [mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of Andy Bunn
> Sent: Tuesday, July 19, 2005 3:59 PM
> To: Sundar Dorai-Raj
> Cc: R-Help
> Subject: Re: [R] extracting row means from a list
>
>
> I think about half of my question in R can be solved with a judicious
> do.call.
>
> Thanks, Andy
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
>
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Jul 20 08:40:23 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:50 EST