Re: [R] [Q] use of expression() in plot() vs. hist()

Prof Brian D Ripley (ripley@stats.ox.ac.uk)
Thu, 18 Feb 1999 22:11:00 +0000 (GMT)

Date: Thu, 18 Feb 1999 22:11:00 +0000 (GMT)
From: Prof Brian D Ripley <ripley@stats.ox.ac.uk>
To: Peter Dalgaard BSA <p.dalgaard@biostat.ku.dk>
Subject: Re: [R] [Q] use of expression() in plot() vs. hist()
In-Reply-To: <x2yalvk0zz.fsf@blueberry.kubism.ku.dk>

On 18 Feb 1999, Peter Dalgaard BSA wrote:

> George White <gwhite@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@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@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


This archive was generated by hypermail 1.02.