Skip to content
Prev 140168 / 398506 Next

Question about as.numeric with tclvalue

It's not clear what is going on here, but one possibility is
[1] NA
Warning message:
NAs introduced by coercion

OTOH, "Inf" works for me.

The difference is that 'Inf' is a standard C99 value (like 1.23), whereas 
'pi' is a variable in R.  So if you want to allow expressions you need to 
parse and eval them, something like

inp <- "pi"
assign("a", eval(parse(text=inp)), .GlobalEnv)

As ever, please see the message footer and remember to supply a 
reproducible example.
On Sun, 23 Mar 2008, Erin Hodgess wrote: