[R] factor always have type integer

Erich Neuwirth erich.neuwirth at univie.ac.at
Thu Sep 9 00:36:08 CEST 2004


The simple answer to my problem (are the values of a vector
numeric or not) is is.numeric, and that is enough for
what I need right now.
But this way I do not get an answer discriminating between
integers and and doubles. What is the canonical way of getting the
type of the values of a vector?
Is there a better way than
valtype<-function(x)
     typeof(ifelse(is.factor(x),levels(x),x))



-- 
Erich Neuwirth, Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-38624 Fax: +43-1-4277-9386




More information about the R-help mailing list