Philippe Grosjean wrote:
> Thank you, but I already know that. I am not surprised by this behavior,
> but by an inconsistency between that behavior and the documentation that
> says "For factors, this uses the levels (labels).", which it does not.
> Best,
My gut feeling say that the docs need to
Thank you, but I already know that. I am not surprised by this behavior,
but by an inconsistency between that behavior and the documentation that
says "For factors, this uses the levels (labels).", which it does not.
Best,
Philippe
On 15/08/10 16:09, R Help wrote:
The problem is that, underne
The problem is that, underneath the factors are actually numbers (1
and 2), where as, if you extract the levels and then get the logical,
it converts them to strings and then to logicals. I run into this
problem ALL THE TIME with numerics in a dataset. Consider the
following:
> factor(c(3,6,5,2,
Hello,
According to ?as.logical:
"as.logical attempts to coerce its argument to be of logical type. For
factors, this uses the levels (labels)."
However,
> as.logical(factor(c("FALSE", "TRUE")))
[1] TRUE TRUE
Shouldn't it be the same as:
> as.logical(levels(factor(c("FALSE", "TRUE"
[1]
4 matches
Mail list logo