[R] Conversion from expression to numeric

Barry Rowlingson B.Rowlingson at lancaster.ac.uk
Thu Nov 23 18:08:16 CET 2006


Paul Smith 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

Barry



More information about the R-help mailing list