[R] Selecting numeric data from a data frame

Peter Dalgaard P.Dalgaard at biostat.ku.dk
Tue Oct 7 16:35:40 CEST 2008


Meir Preiszler wrote:
> Hi
>
> I have a data frame containing numeric and factor data.
> I want to extract the numeric data only. How can this be done?
>
> Thanks
> Meir
>
>   
d[sapply(d,is.numeric)]

-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)              FAX: (+45) 35327907



More information about the R-help mailing list