[R] Combining expressions and objects within labels
Jose A. Hernandez
jahernan at umn.edu
Sun Nov 14 21:01:03 CET 2004
Hello all,
I am an R novice and I have a simple question and hope somebody can help
me out.
I need to place several labels in a plot, this labels are some kind of
text and also some objects (which come from some more complicated R
calculations).
In one of this labels I'd like to place a superscript, however I cannot
find a way to place both the expression and the object in the same label.
Thanks in advance and best regards.
Please look at the example below:
# my objects
eonr <- 75
yldeonr <- 150
r_2 <- 0.95
# the plot and simple labels
plot(0:100, 0:100)
text(60,40, paste("EONR=",eonr))
text(60,36, paste("Yield at EONR=",yldeonr))
# I'd like to place the superscript on the r
text(60,32, paste("Pseudo r^2=",r_2))
# This does not seem to work ... I can get the subscript
# but now I cannot paste the r_2 object. Any ideas ?
text(60,28, expression(paste("Pseudo r" ^2, "=" r_2)))
--
Jose A. Hernandez
Department of Soil, Water, and Climate
University of Minnesota
1991 Upper Buford Circle
St. Paul, MN 55108
Ph. (612) 625-0445, Fax. (612) 625-2208
More information about the R-help
mailing list