Re: [R] Convert dataframe to array of records

2009-09-05 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Jeroen Ooms > Sent: Saturday, September 05, 2009 9:20 AM > To: r-help@r-project.org > Subject: [R] Convert dataframe to array of records > > >

[R] Convert dataframe to array of records

2009-09-05 Thread Jeroen Ooms
I would like to convert a dataframe to an array of lists, one for every record. A natural choide is apply as.list to the rows. However, as it seems, as.list() automatically converts all list elements to the same datatype. Eg: myData <- data.frame(a="foo",b=as.logical(rbinom(10,1,.5))); apply(myDa