[R] Question about 'text' (add lm summary to a plot)

Gabor Grothendieck ggrothendieck at gmail.com
Fri Jul 22 20:01:38 CEST 2005


You are right.   One would have to use do.call as you did
or the sapply method of one of my previous posts:

a <- 7
plot(1)
L <- list(bquote(alpha==.(a)),bquote(alpha^2+1==.(a^2+1)))
legend("topleft",legend=sapply(L, as.expression))


On 7/22/05, Thomas Lumley <tlumley at u.washington.edu> wrote:
> On Fri, 22 Jul 2005, Gabor Grothendieck wrote:
> >
> > I think legend accepts a list argument directly so that could be
> > simplified to just:
> >
> >  a<-7
> >  plot(1)
> >  L <- list(bquote(alpha==.(a)),bquote(alpha^2+1==.(a^2+1)))
> >  legend("topleft",legend=L)
> 
> Except that it wouldn't then work: the mathematical stuff comes out as
> text.
> 
> > The same comment seems to apply to my prior suggestion about
> > as.expression(bquote(...)), namely that one can just write the
> > following as text also supports a list argument:
> 
> And this doesn't work either: you end up with %+-% rather than the
> plus-or-minus symbol.
> 
> The reason I gave the do.call() version is that I had tried these simpler
> versions and they didn't work.
> 
>        -thomas
> 
>




More information about the R-help mailing list