It's not clear what is going on here, but one possibility is
> as.numeric("pi")
[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:
> Dear R People:
>
> I have an interactive menu via an Rcmdr extension package which asks
> for lower and upper limit to evaluate.
>
> Typically, I use:
>
> assign("a",as.numeric(tclvalue(lowlim)),envir=.GlobalEnv)
>
> and that's fine.
>
> However, if I try to use pi or Inf or -Inf, I get either coerced NAs or
NaN.
>
> Does anyone have any suggestions, please?
>
> Thanks,
> Erin
> PS Happy Easter if you celebrate Easter.
>
>
> --
> Erin Hodgess
> Associate Professor
> Department of Computer and Mathematical Sciences
> University of Houston - Downtown
> mailto: erinm.hodgess at gmail.com
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595