[R] as.numeric

Uwe Ligges ligges at statistik.uni-dortmund.de
Wed Jul 24 14:55:49 CEST 2002


Mike Lonergan wrote:
> 
> Why is as.numeric("3/2") NA plus a warning?

Because "3/2" is a character string that cannot be coerced to numeric
easily.
You mean: You want to evaluate the expression(!) 3/2, which is - whyever
- inquotation marks.

Maybe the following line is more appropriate to you problem?
 eval(parse(text="3/2"))

Uwe Ligges
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list