Re: [R] plotmath question

From: Thomas Lumley <>
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


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


> 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))))
> mailing list PLEASE do read the posting guide! 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