"Paul Smith" <[EMAIL PROTECTED]> writes:

> Thanks, Peter. I did not know about the existence of the command
> 'eval', in spite of the fact of having searched the Internet for a
> solution for my problem.
> 
> 'eval' seems not working in connection with Ryacas:
> 
> > library(Ryacas)
> > x <- yacas("2/3*5/7")
> > x
> expression(10/21)
> > eval(x)
> expression(10/21)
> >
> 
> To work, one has to do the following:
> > eval(x)
> expression(10/21)
> > eval(as.expression(x))
> [1] 0.4761905

This could be the following effect in action:

> quote(expression(10/21))
expression(10/21)
> eval(quote(expression(10/21)))
expression(10/21)
> eval(eval(quote(expression(10/21))))
[1] 0.4761905

which is one of the weirder anomalies in the parse/deparse area in the
R language. Part of the secret is

> quote(expression(10/21))
expression(10/21)
> mode(quote(expression(10/21)))
[1] "call"
> mode(expression(10/21))
[1] "expression"

and you might look at mode(x) to see whether this is relevant to Ryacas.

-- 
   O__  ---- Peter Dalgaard             Ă˜ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - ([EMAIL PROTECTED])                  FAX: (+45) 35327907

______________________________________________
R-help@stat.math.ethz.ch 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.

Reply via email to