[R] Axis labels

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Tue Aug 28 20:54:42 CEST 2001


Uwe Ligges <ligges at statistik.uni-dortmund.de> writes:

> Gavin Simpson wrote:
> > 
> > Hi,
> > 
> > I am trying to label the x-axis of some histograms with the units of
> > measurement.
> > 
> > However, when I use, for example:
> > 
> > > truehist(Ca, prob=FALSE, col="gray", xlab=expression(paste("Calcium
> > (", mu, eq^-1, ")")))
> > 
> > I get the following message:
> > 
> > Error in eval(expr, envir, enclos) : Object "mu" not found
> > 
> > Could someone let me know what I'm doing wrong?
> 
> 
> truehist (which is in the package MASS !):
> 
> function(   ...   )
> {
>   eval(xlab)
>   ...
> 
> So the first line in the body of truehist() causes your problem.
> You don't need this line in your case, I think. So just create your own
> function without this line.  Maybe the author of the function can help
> more precisely.

Whoops, that's a bug... You want just plain "xlab" without the eval()
in such cases. The reason for having it at all is to force lazy
evaluation of the default expression before "data" changes and becomes
a local variable.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list