[R] Conversion from expression to numeric

Paul Smith phhs80 at gmail.com
Thu Nov 23 18:10:37 CET 2006


On 11/23/06, Barry Rowlingson <B.Rowlingson at lancaster.ac.uk> wrote:
> >>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?
> >
>
>   eval-uate the expression:
>
>   > x <- expression(62/100)
>   > eval(x)
>   [1] 0.62

That is it, Barry. Thanks.

Paul



More information about the R-help mailing list