R-beta: Including an evaluated function in text expression

Matthew R. Nelson mrn at superh.hg.med.umich.edu
Fri Mar 27 20:05:53 CET 1998


I would like to take advantage of R's mathematical typesetting 
capabilities in the graphical environment using text(..., 
expression(...)), however, I can't figure out how to include in the 
expression some evaluated function.  For example,

> x <- 1:8
> plot(1:10, 1:10)
> text(5, 5, expression(sum(x[i], i == 1, length(x)))  # would like "8" 
                                        # substituted for length(x) here

Is there a way to replace length(x) with the returned value of the 

Thanks for any advice,

Matthew R. Nelson
Dept. of Human Genetics         
University of Michigan              http://www-personal.umich.edu/~ticul/
4711 Medical Science II             email: ticul at umich.edu
Ann Arbor, MI  48109-0618           phone: (313) 647-3151

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list