[R] use of bquote
r.turner at auckland.ac.nz
Fri Nov 22 07:53:10 CET 2013
On 11/22/13 18:47, William Dunlap wrote:
>> a <- 2; b <- 3; xyplot(1:10 ~ a*(1:10), sub = c(bquote(a == .(a) ~ b==.(b))))
>> the subtitle contains three copies of the "a = 2 b = 3" phrase.
>> Why does it do that? How do I tell it to give me only one copy?
> To avoid it don't wrap bquote() with c(). The following does what you asked for:
> a <- 2; b <- 3; xyplot(1:10 ~ a*(1:10), sub = bquote(a == .(a) ~ b==.(b)))
Not for me it doesn't. Without the c() wrapper, I get no subtitle at
all. Your recipe seems to
work with base graphics and plot() but not with lattice and xyplot().
Also the c() wrapper
seems to have no impact when used with plot().
Moreover I am mystified by the impact of the c() wrapper when used with
The result returned by bquote() has class "call". The result returned
by c(bquote(...)) is a
list, of length 1, whose sole entry is of class "call" and is, as one
might expect, equal to the
result returned by bquote().
But why should passing this length-1 list as the value for "sub" cause a
triplication of the
More information about the R-help