[Rd] Expressions from boxplot() passed to bxp()
pd@|gd @end|ng |rom gm@||@com
Fri Mar 27 10:53:25 CET 2020
It's not new anyway. You see the same behaviour with
and it boils down to the use of do.call("bxp", ...) in the internals.
As a general matter, expression() exists to prevent this sort of confusion, e.g., in this construction,
> X <- quote(Y+1); bquote(f(.(X)))
f(Y + 1)
is indistinguishable from just entering f(Y+1), so f has no way of detecting whether or not it is intended to evaluate Y + 1. The same thing is happening with do.call: call objects are being "spliced into" the generated call, and if they are not protected with expression, you have the trouble.
I don't know whether it is worth trying to change this. You know the workaround.
> On 27 Mar 2020, at 02:55 , Marius Hofert <marius.hofert using uwaterloo.ca> wrote:
> Is this expected behavior (R-3.6.0)?
> dat <- cbind(x = 1:10, y = 10:1)
> ylab <- substitute(X[t], list(t = 2))
> plot(dat, ylab = ylab) # works (correctly displays ylab)
> boxplot(dat, ylab = ylab) # fails
> boxplot(dat, ylab = as.expression(ylab)) # works
> Thanks & cheers,
> R-devel using r-project.org mailing list
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Office: A 4.23
Email: pd.mes using cbs.dk Priv: PDalgd using gmail.com
More information about the R-devel