Re: [R] Convert a matrix's columns to list

2011-01-18 Thread Vito Muggeo (UniPa)
hi feng, a possible solution is b1<-apply(a,2,list) and possibly lapply(b1,unlist) if you want exactly the output equal to "list(a[, 1], a[, 2])" best, vito Il 18/01/2011 13.53, Feng Li ha scritto: Dear R, Is there an efficient way to make a list that each element is from the corresponding

Re: [R] Convert a matrix's columns to list

2011-01-18 Thread Henrique Dallazuanna
Try this: c(unname(as.data.frame(a))) On Tue, Jan 18, 2011 at 10:53 AM, Feng Li wrote: > Dear R, > > Is there an efficient way to make a list that each element is from the > corresponding column of a matrix. For example, if I have a matrix "a" > > > a <- matrix(1:10, 5, 2) > > a > [,1] [,2

[R] Convert a matrix's columns to list

2011-01-18 Thread Feng Li
Dear R, Is there an efficient way to make a list that each element is from the corresponding column of a matrix. For example, if I have a matrix "a" > a <- matrix(1:10, 5, 2) > a [,1] [,2] [1,]16 [2,]27 [3,]38 [4,]49 [5,]5 10 I would like to have a list