Try: aa <- 22 plot(1, main = bquote(a == .(aa)))
On Wed, Dec 31, 2008 at 11:47 AM, Mike Prager <[email protected]> wrote: > I hope to use the plotmath facility to print titles that mix > math and values of R variables. > > The help for "plotmath" has an example, which after repeated > reading, I find baffling. Likewise, I have read the help file > for "substitute" (wqhich seems to be needed) without ever > understanding what it does, other than being used in some magic > incantations. > > I would like to do something like this: > > dev.new() > aa <- round(pi,2) > plot(1:3, 1:3, main = ~ a == aa) > > and have the main title read "a = 3.14" > > but of course it reads "a = aa". > > >From a user's point of view -- one who has never written a > parser nor taken a course in compilers -- what is needed is the > nonexistent function "value" usable in plotmath expressions to > produce the value of its argument, as > > plot(1:3, 1:3, main = ~ a == value(aa)) > > How can this be done? > > THANKS! > > -- > Mike Prager, NOAA, Beaufort, NC > * Opinions expressed are personal and not represented otherwise. > * Any use of tradenames does not constitute a NOAA endorsement. > > ______________________________________________ > [email protected] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

