try: mtext(substitute(R^2 * ": "* GoodnessOfFits[i],list(i=graphNumber)))
HTH. On 3/16/07, Bob Farmer <[EMAIL PROTECTED]> wrote: > Hi all: > > I would like to create a line of plot margin text (using mtext() ) that > features both a superscript and a subset of an object. However, I > cannot seem to do both things at once, nor have I found a way to paste > the two results together. > > (I pull the object subset because this is part of a for-next loop to > make multiple graphs) > > This example doesn't give me what I want from mtext(): > > GoodnessOfFits<-c(1, 0.75) > > graphNumber<-1 #first loop of the for-next loop (not shown) > > x<-seq(-10, 10, 1) > y<-(x^2) > plot(x,y) > lines(x, predict(lm(y~I(x^2)))) > mtext(text= > expression(R^2 * ": "* GoodnessOfFits[graphNumber])) > > > I recognize that in this example, I could extract the R-squared value > from the model in each loop, however this does not apply to my more > complicated real scenario. > > Any suggestions? > > Thanks. > --Bob Farmer > > ______________________________________________ > [email protected] 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. > ______________________________________________ [email protected] 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.
