Dear r-helpers, I have some multiplot figures that I would like to annotate. To each plot frame I would like to add the associated correlation coefficients. To do so, I believe I need to understand the usage of `expression' better. The following is a good start. petstring <- expression(paste(r[rho*p],"=" )) mtext(petstring, line=0.3, adj=0.1, cex=0.8) My question is, how can I interpolate a variable into this expression? I would like petstring to contain r[rho*p] = peti, where peti is the corr. coefficient that would vary across panes in the figure. I have tried various combinations of paste and expression and have not hit on the right combination (instead I usually get peti as a literal rather than a variable). Thanks, Alex Buerkle ~^^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^ C. Alex Buerkle Ph: 812-855-9018 Jordan Hall 142 Fax: 812-855-6705 Department of Biology Indiana University Bloomington, IN 47405 cbuerkle at bio.indiana.edu -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
r-help[Q]: use of `expression' in annotation
2 messages · Alex Buerkle, Peter Dalgaard
Alex Buerkle <cbuerkle at bio.indiana.edu> writes:
I would like petstring to contain r[rho*p] = peti, where peti is the corr. coefficient that would vary across panes in the figure. I have tried various combinations of paste and expression and have not hit on the right combination (instead I usually get peti as a literal rather than a variable).
Consider the following: plot(0:11,type='n') for (x in 1:10) text(x,x,as.expression(substitute(r[rho*p] == peti,list(peti=x/10)))) [which probably also indicates that the as.char.or.expr() function used inside text() could use modification! The as.expression bit should be avoidable on objects of mode call.]
O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._