[R] Convert data.frame or matrix to list
Dror
droryosef at hotmail.com
Wed May 12 14:13:00 CEST 2010
Hi,
i have the following data.frame :
> Data[1:3,]
dt amt geoTree merTree ref
1 0.71002484 3.334570 A2b B2b 0
2 0.49074936 2.544464 A2b B1a 0
3 0.06223433 3.617133 A1b B2a 0
i want to convert it to a list, like this:
list(Data[1,],Data[2,],Data[3,])
[[1]]
dt amt geoTree merTree ref
1 0.07333459 0.969585 A2a A1a 0
[[2]]
dt amt geoTree merTree ref
2 0.5197299 4.489454 A2b A2b 0
[[3]]
dt amt geoTree merTree ref
3 0.8677384 5.696927 A1a B2a 0
is there a more elegant way to do so (i can have much more than 3 rows)?
Thanks,
Dror
--
View this message in context: http://r.789695.n4.nabble.com/Convert-data-frame-or-matrix-to-list-tp2195931p2195931.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list