[R] explicit coercion warnings as.numeric Versus as.logical
Ramnik Bansal
ramnik.bansal at gmail.com
Mon Nov 21 10:52:58 CET 2016
Hi,
I am trying to understand under which specific conditions does explicit
coercion produce warnings.
> as.numeric(c(1, F, "b"))
[1] 1 NA NA
Warning message:
NAs introduced by coercion
> as.logical(c(1, F, "b"))
[1] NA FALSE NA
In above examples, as.numeric produces warning but as.logical does not.
What is the reason behind this different behaviour. Ideally as.logical
should also have produced the warning message like as.numeric.
Thanks in advance.
Ramnik
[[alternative HTML version deleted]]
More information about the R-help
mailing list