Dear socrates;
It did not take me 2.5 hours but it did take longer than I thought it
would. I worked off the example given by Henrique Dallazuanna seen at:
http://finzi.psych.upenn.edu/R/Rhelp08/archive/120065.html
This seems "to work":
mtext(bquote(100~"%" ~ Area == ~ .(text.val)~ Km^2), side=3)
I cannot say the the syntactic rules are entirely clear. The proper
placement of the tildes is a bit mysterious to me. I am wondering if a
solution using substitute(expression(.)) might be more clear but my
efforts in that direction were not successful.
--
David
On Mar 11, 2009, at 10:08 AM, socrates wrote:
I am trying to get the following line in a plot margin using mtext:
100% Area = 120.000 km^2
Where I intend that "100% Area =" is text, 120.000 is a number that
varies
according to different data, and km^2 should be a neat
km-with-superscript-2.
The expression function fails me, since it apparently cannot coerce an
expression when a variable is involved.
In the R help file there is an example using either bquote or
substitute to
accomplish like things, but these are sufficiently different from my
objective and I am becoming more and more confused by every further
example
I stumble on.
This should be easy. Can anyone help me prevent spending anoter 2.5
hours on
the matter? Thanks.
--
View this message in context:
http://www.nabble.com/Combining-math-and-variables-in-expression-tp22455877p22455877.html
Sent from the R help mailing list archive at Nabble.com.
______________________________________________
R-help@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.
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
______________________________________________
R-help@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.