Gabor Grothendieck <ggrothendieck at gmail.com> writes:
> ?bquote says it returns an expression but, in fact, it typically
> (though not always) returns a call object:
>
> > class(bquote(a+b))
> [1] "call"
>
> > class(bquote(1))
> [1] "numeric"
Unevaluated expressions and objects of mode "expression" are not the
same thing. The latter is effectively a list wrapping one or more of
the former.
Unevaluated expressions are generally mode "call", except when they
are constants. They do, however, correspond to expressions as
syntactic element (look for "expr" inside gram.y in the sources).
The terminology does not seem completely rationalised, see also the
help pages for expression() and substitute()/quote(), and it might be
worth cleaning it up at some point. Just requires someone with a
sufficiently clear mind to decide on issues like whether constants
qualify as "unevaluated calls"... (my hunch is that they don't,
and
that "unevaluated expressions" should be used throughout, but my mind
is definitely not clear these days.)
Another question is whether it would be desirable for bquote to return
an "expression" object. I realized recently that
> boxplot(rnorm(99),ylab=quote(a[1]))
Error in title(ylab = a[1]) : object "a" not found
and that you need expression(a[1]) instead. I think this implies that
you'd have to use as.expression(bquote(....)) which is a bit nasty.
I'm not sure this isn't a bug in boxplot, though.
--
O__ ---- Peter Dalgaard ?ster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907