Displaying 1 result from an estimated 1 matches for "rowsofdataframe".
2009 Sep 05
1
Convert dataframe to array of records
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(myData,1,as.list);
In this output, all boolean values have been converted to character