[R] Conversion from expression to numeric
Paul Smith
phhs80 at gmail.com
Thu Nov 23 17:54:38 CET 2006
Dear All
I am trying to convert from the type "expression" to the type
"numeric". The following works:
> x <- expression(6.2)
> as.numeric(as.character(x))
[1] 6.2
However, the following does not work:
> x <- expression(62/100)
> as.numeric(as.character(x))
[1] NA
Warning message:
NAs introduced by coercion
Any idea about how to deal with the second case?
Thanks in advance,
Paul
More information about the R-help
mailing list