Try:
> x <-
data.frame(a=factor(letters[1:3]),b=I(LETTERS[1:3]),c=as.integer(1:3),d=(1:3)/10)
> sapply(x, is.numeric)
a b c d
FALSE FALSE TRUE TRUE
> sapply(x, mode)
a b c d
"numeric" "character" "numeric"
"numeric"
> sapply(x, storage.mode)
a b c d
"integer" "character" "integer"
"double"
> sapply(x, class)
$a
[1] "factor"
$b
[1] "AsIs"
$c
NULL
$d
NULL
> sapply(x, data.class)
a b c d
"factor" "AsIs" "numeric" "numeric"
>
At 03:27 PM 11/11/2002 -0500, Blew, Ted wrote:>is there a way to identify the *numeric* data elements (columns) in a
>data.frame that contains both numeric and character data elements? thanks
>in advance, ted.
>
>----------------------------------------
>Ted Blew
>Educational Testing Service
>MS 22T
>Princeton NJ 08541
>tblew at ets.org
>609.734.5976 (office)
>
>
>
>
>**************************************************************************
>This e-mail and any files transmitted with it may contain privileged or
>confidential information. It is solely for use by the individual for whom
>it is intended, even if addressed incorrectly. If you received this e-mail
>in error, please notify the sender; do not disclose, copy, distribute, or
>take any action in reliance on the contents of this information; and delete
>it from your system. Any other use of this e-mail is prohibited. Thank you
>for your compliance.
>
>
>
>-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
>r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
>Send "info", "help", or "[un]subscribe"
>(in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
>_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._