[R] Plotmath with values?
Charles C. Berry
cberry at tajo.ucsd.edu
Wed Dec 31 18:54:01 CET 2008
On Wed, 31 Dec 2008, Mike Prager 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)
It has another example, too, along these lines:
plot(1:3, 1:3, main = bquote(a == .(aa)))
You have to follow a couple of 'See Also' links from the plothmath page to
get to
?bquote
HTH,
Chuck
>
> 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.
>
> ______________________________________________
> R-help at r-project.org 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.
>
Charles C. Berry (858) 534-2098
Dept of Family/Preventive Medicine
E mailto:cberry at tajo.ucsd.edu UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901
More information about the R-help
mailing list