Re: [R] Extract rows from a list object

2010-08-24 Thread Vladimir Mikryukov
Thanks a lot!! It sure helped. and many thanks to all other repliers! On Tue, Aug 24, 2010 at 3:40 PM, Dimitris Rizopoulos < d.rizopou...@erasmusmc.nl> wrote: > try something like this: > > n <- 23 > x <- array(1:20, dim = c(n, 6)) > huge.list <- rep(list(x), 1000) > > out <- lapply(1:4, functio

Re: [R] Extract rows from a list object

2010-08-24 Thread peter dalgaard
On Aug 24, 2010, at 11:29 AM, Vladimir Mikryukov wrote: > Dear list members, > > I need to create a table from a huge list object, > this list consists of matrices of the same size (but with different > content). > > The resulting n tables should contain the same rows from all matrices. > > Fo

Re: [R] Extract rows from a list object

2010-08-24 Thread Dimitris Rizopoulos
try something like this: n <- 23 x <- array(1:20, dim = c(n, 6)) huge.list <- rep(list(x), 1000) out <- lapply(1:4, function (i) { t(sapply(huge.list, "[", i = i, j = 1:6)) }) out[[1]] out[[4]] I hope it helps. Best, Dimitris On 8/24/2010 11:29 AM, Vladimir Mikryukov wrote: Dear list

[R] Extract rows from a list object

2010-08-24 Thread Vladimir Mikryukov
Dear list members, I need to create a table from a huge list object, this list consists of matrices of the same size (but with different content). The resulting n tables should contain the same rows from all matrices. For example: n <- 23 x <- array(1:20, dim=c(n,6)) huge.list <- list() for (i