forcing apply() to return data frame
On Fri, 21 Apr 2006, Federico Calboli wrote:
Hi All, I am (almost) successfully using apply() to apply a function recursively on a data matrix. The function is question is as.genotype() from the library 'genetics' apply(subset(chr1, names$breed == 'lab'),2,as.genotype,sep ="") Unfortuantely apply puts it's results into a matrix object rather than a data frame, tranforming my factors into numerics and making the results useless. Is there a way of forcing apply() to return a data frame rather than a matrix?
The conversion to a matrix happens on the way in to apply, not on the way out, so no. -thomas Thomas Lumley Assoc. Professor, Biostatistics tlumley at u.washington.edu University of Washington, Seattle