[R] converting string fractions to numerics

Erin Hodgess erinm.hodgess at gmail.com
Wed Oct 19 08:30:01 CEST 2011

Dear R People:

Suppose I have the following:


and I would like it to be 1.57.....

Using as.numeric, here is my result:

> as.numeric("pi/2")
[1] NA
Warning message:
NAs introduced by coercion

Is there a way to produce the numeric result, please?


Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: erinm.hodgess at gmail.com

More information about the R-help mailing list