[R] Combining math and variables in expression

socrates schouten at cml.leidenuniv.nl
Wed Mar 11 15:08:14 CET 2009


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.




More information about the R-help mailing list