Warnings are a good thing and can help to find errors in data.
But with newer R versions I get more and more warnings
which I would like to suppress in defined circumstances.

In the manual of as.numeric() is noticed:
        as.numeric(c("-.1"," 2.7 ","B")) # (-0.1, 2.7, NA)  +  warning

If I know that my data contains characters and if I would like
that they will be converted to NA: how I can turn off just this warning?

(I know I could do: options(warn=-1). But then I will miss all
other possibly necessary warnings.)

I would like to have an argument to as.numeric() like na.coerce=TRUE.
It would be especially helpful when converting factors to numbers by doing:
        as.numeric( levels( x ) )[ x ] 

What could I do?

Best regards - Wolfram

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to