[R] [Q] use of expression() in plot() vs. hist()
Prof Brian D Ripley
ripley at stats.ox.ac.uk
Thu Feb 18 23:11:00 CET 1999
On 18 Feb 1999, Peter Dalgaard BSA wrote:
> George White <gwhite at bodnext.bio.dfo.ca> writes:
>
> > > First of all, I don't know where people are getting that paste()
> > > construction from. The juxtaposion operator for plotting math is "*",
> > > i.e.
> > >
> > > hist(c(0,0,0,0,4,5,6,6,6,8), xlab=expression("scaled "*rho))
[I don't seem yet to have got the first reply in this chain, so I don't
know what came afeter `First of all'!]
That fails for me as well. The problem is something different: hist
contains eval(xlab), and eval(expression("scaled "*rho)) will fail unless
rho is present. This is why pi works: there is an object called pi.
I think
if(missing(xlab)) eval(xlab)
in hist.default will fix this (and ditto for main); it does fix this
example. But I would like an explanation of why the eval is needed (it is)
here and not, say, in plot. There is something about R's evaluation
model that I just don't follow here.
--
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 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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