Re: [R] Question on list object

2011-04-27 Thread Henrique Dallazuanna
Try this: sapply(listObj, '[', 1:max(sapply(listObj, length))) On Wed, Apr 27, 2011 at 2:23 PM, Bogaso Christofer wrote: > Dear all, let say, I have following list object: > > > > listObj <- vector("list", length = 3) > > listObj[[1]] <- rnorm(3) > > listObj[[2]] <- rnorm(4) > > listObj[[3]] <-

Re: [R] Question on list object

2011-04-27 Thread Phil Spector
Here's one way: uselen = max(sapply(listObj,length)) do.call(rbind,lapply(listObj,function(x){length(x) = uselen;x})) [,1] [,2] [,3] [,4] [,5] [1,] 0.0702225 -1.143031 1.6437560 NANA [2,] -0.6100869 2.657910 -0.6028418 -0.7739858NA [3,

Re: [R] Question on list object

2011-04-27 Thread Jorge Ivan Velez
Hi Christofer, You might try sapply(listObj, function(l) l[1:max(sapply(listObj, length))] ) HTH, Jorge On Wed, Apr 27, 2011 at 1:23 PM, Bogaso Christofer <> wrote: > Dear all, let say, I have following list object: > > > > listObj <- vector("list", length = 3) > > listObj[[1]] <- rnorm(3) >