Re: [R] merge numerous columns of unequal length

2008-05-06 Thread Patrick Burns
As the answers you've received suggest, you can use a list. Or you could have two vectors: one with the data, the other with the group identity. The latter format is likely more convenient for a lot of analyses. Since your data are not inherently rectangular, it is probably best to get the

Re: [R] merge numerous columns of unequal length

2008-05-06 Thread T.D.Rudolph
Indeed both options are salable, though I agree the latter may be more convenient. Merci! Patrick Burns wrote: As the answers you've received suggest, you can use a list. Or you could have two vectors: one with the data, the other with the group identity. The latter format is likely

[R] merge numerous columns of unequal length

2008-05-05 Thread T.D.Rudolph
I have numerous objects, each containing continuous data representing the same variable, movement rate, yet each having a different number of rows. e.g. d1-as.matrix(rnorm(5)) d2-as.matrix(rnorm(3)) d3-as.matrix(rnorm(6)) How can I merge these three columns side-by-side in order to create a

Re: [R] merge numerous columns of unequal length

2008-05-05 Thread markleeds
you can do below but there's no way of getting arounf having NAs in your final matrix. d1-as.matrix(rnorm(5)) d2-as.matrix(rnorm(3)) d3-as.matrix(rnorm(6)) templist - list(d1,d2,d3) maxnum - max(sapply(templist,length)) print(maxnum) temp - lapply(templist,function(.mat) { if (nrow(.mat)

Re: [R] merge numerous columns of unequal length

2008-05-05 Thread Henrique Dallazuanna
Try this also: sapply(list(d1, d2, d3), [, 1:max(sapply(list(d1, d2, d3), length))) On Mon, May 5, 2008 at 7:46 PM, T.D.Rudolph [EMAIL PROTECTED] wrote: I have numerous objects, each containing continuous data representing the same variable, movement rate, yet each having a different number