[R] Factors and NaN
dwinsemius at comcast.net
Fri Dec 5 19:31:05 CET 2014
On Dec 5, 2014, at 7:16 AM, Dinesh Chowdhary wrote:
>> x <- factor(c("yes", "yes", "no", NA, "yes", "no", NaN))
>  yes yes no <NA> yes no NaN
> Levels: NaN no yes
>  FALSE FALSE FALSE FALSE FALSE FALSE FALSE
>> From the above snippet can you notice that the "NaN" value is not logically
> identified in a vector? Can anyone elaborate on this?
It gets converted to a character value. (As always... Read the help page.)
> x <- factor(c("yes", "yes", "no", NA, "yes", "no", NaN), exclude=c(NA,NaN) )
 yes yes no <NA> yes no <NA>
Levels: no yes
> Thank you for your effort!
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Alameda, CA, USA
More information about the R-help