[R] extract numerical variables from a data frame

Simon Fear Simon.Fear at synequanon.com
Fri Aug 29 11:24:22 CEST 2003


for data.frame called dframe:

newframe <- dframe[ , lapply(dframe, is.numeric)]

For the mode of the columns

lapply(dframe, mode)

See ?lapply !!

> -----Original Message-----
> From: Vincent Spiesser [mailto:Vincent.Spiesser at univ-tlse1.fr]
> Sent: 29 August 2003 10:08
> To: R-help at stat.math.ethz.ch
> Subject: [R] extract numerical variables from a data frame
> 
> 
> Security Warning:
> If you are not sure an attachment is safe to open please contact 
> Andy on x234. There are 0 attachments with this message.
> ________________________________________________________________
> 
> Hi
> 
> I try to create from a data frame a new one which contains only the 
> numerical variables (or factorial ones).
> 
> Is there any function which does this task directly ?
> Or, is there any function which return the mode of each columns of a
> data 
> frame. ?
> 
> Thanks a lot for any help you can offer me,
> 
> Vincent Spiesser
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
 

Simon Fear
Senior Statistician
Syne qua non Ltd
Tel: +44 (0) 1379 644449
Fax: +44 (0) 1379 644445
email: Simon.Fear at synequanon.com
web: http://www.synequanon.com
 
Number of attachments included with this message: 0
 
This message (and any associated files) is confidential and\...{{dropped}}




More information about the R-help mailing list