From: Thomas Lumley <tlumley_at_u.washington.edu>

Date: Sat 19 Mar 2005 - 10:19:49 EST

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 Received on Sat Mar 19 10:22:10 2005

Date: Sat 19 Mar 2005 - 10:19:49 EST

On Fri, 18 Mar 2005, Berton Gunter wrote:

*>
*

> 2) The plotmath Help state that expressions can be used for axis labels, so

*> I would have expected the above to work without the eval()call -- but it
**> does not. Would someone kindly explain to me why not -- i.e., what I have
**> misunderstood. That is, to be clear, why does the following not work:
*

Because substitute() doesn't evaluate its argument: the result is not an expression but a call to the expression() function.

An example where it is clearer what is going on

substitute(log(x),list(x=1))

doesn't return a number, even though log() returns a number. It returns a call to log() that still has to be evaluated

-thomas

*> for(i in seq(-3,to=3))
**> axis(1,at=i, lab=switch(sign(i)+2,
**> substitute(expression(mu-j*sigma),list(j=i)),
**> expression(mu),
**> substitute(expression(mu+j*sigma),list(j=i))))
**>
*

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 Received on Sat Mar 19 10:22:10 2005

*
This archive was generated by hypermail 2.1.8
: Fri 03 Mar 2006 - 03:30:51 EST
*