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

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Sat 23 Jul 2005 - 04:01:38 EST

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@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
>
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Jul 23 04:06:01 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:57 EST