Skip to content
Prev 140207 / 398506 Next

as.numeric with tclvalue redux

Erin Hodgess wrote:
Brian already told you: Parse and eval.

 > eval(parse(text=as.character(tclvalue(tclVar("pi")))))
[1] 3.141593

(Beware: Depending on the environment in which you eval(), strange 
things can happen if you use the name of an internal variable in your 
function)

What happened with the Inf issue? I can't reproduce that:

 > as.numeric(as.tclObj("Inf"))
[1] Inf