Try this: split(Data, 1:nrow(Data))
On Wed, May 12, 2010 at 9:13 AM, Dror <droryo...@hotmail.com> wrote: > > 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. > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.