All - I'm a novice at R and I'm having difficulty combining text and an expression in the same label. I just trying to get Yield (kg ha-1) and have the -1 as superscript. What I came up with doesn't work. I'm stuck at trying to concatenate it with any other regular text. yield1 = "Yield (kg ha" yield2 = expression(^-1) yield3 = ")" ylabel = paste(yield1, yield2, yield3) boxplot(yield.kgha.st~env,data=lsmeans1, boxwex=0.3, main='Chinese Hybrids', ylim=c(0,5300), sub='', ylab=ylabel, xlab='') any help appreciated, Josh -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Hi> I'm a novice at R and I'm having difficulty combining text and an > expression in the same label. > > I just trying to get Yield (kg ha-1) and have the -1 as superscript. What > I came up with doesn't work. I'm stuck at trying to concatenate it with > any other regular text. > > yield1 = "Yield (kg ha" > yield2 = expression(^-1) > yield3 = ")" > ylabel = paste(yield1, yield2, yield3) > > boxplot(yield.kgha.st~env,data=lsmeans1, > boxwex=0.3, > main='Chinese Hybrids', > ylim=c(0,5300), > sub='', > ylab=ylabel, > xlab='') > > any help appreciated,The following is one way to do what I think you want ... plot(1:10, ylab=expression(paste("Yield (kg ", ha^-1, ")"))) Paul -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Thu, 13 Jun 2002, Josh Udall wrote:> All - > > I'm a novice at R and I'm having difficulty combining text and an > expression in the same label. > > I just trying to get Yield (kg ha-1) and have the -1 as superscript. What > I came up with doesn't work. I'm stuck at trying to concatenate it with > any other regular text. > > yield1 = "Yield (kg ha" > yield2 = expression(^-1) > yield3 = ")" > ylabel = paste(yield1, yield2, yield3) >The problem is that paste() squashes the expression into a string. plot(1,main=expression("Yield " * (kgha^{-1}))) works -thomas -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._