Re: [R] select only the numeric variables

From: Sundar Dorai-Raj <sundar.dorai-raj_at_pdf.com>
Date: Fri 21 Oct 2005 - 04:25:13 EST

lamack lamack wrote:
> Dear all, how can I select only the numeric (or character) variables from a
> date.frame?
>
> Best regards
>

Try:

x[sapply(x, is.numeric)]

x[sapply(x, is.character)]

where `x' is your data.frame.

--sundar



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Oct 21 05:57:11 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 19:14:17 EST