[R] forcing apply() to return data frame

Federico Calboli f.calboli at imperial.ac.uk
Fri Apr 21 16:26:06 CEST 2006

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 

Is there a way of forcing apply() to return a data frame rather than a 



Federico C. F. Calboli
Department of Epidemiology and Public Health
Imperial College, St Mary's Campus
Norfolk Place, London W2 1PG

Tel  +44 (0)20 7594 1602     Fax (+44) 020 7594 3193

f.calboli [.a.t] imperial.ac.uk
f.calboli [.a.t] gmail.com

More information about the R-help mailing list