Skip to content
Back to formatted view

Raw Message

Message-ID: <CACxE24n9=gRXo1kVhjG_63x+LtDE5KEEnJc96JJ3i8Dthjr3Mw@mail.gmail.com>
Date: 2011-10-19T06:30:01Z
From: Erin Hodgess
Subject: converting string fractions to numerics

Dear R People:

Suppose I have the following:

"pi/2"

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?

Thanks,
Erin


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