[R] using the function "expression" with "paste" in a plot

Ahmad Abu Hammour hammour at msn.com
Sat Nov 16 16:04:04 CET 2002

I noticed that paste and expression in the following manner does not produce
the desired result.

# mydata any matrix that takes for the following form
# producing plots
for (j in 1:vx){
for (i in 1:vn)
plot(mydata, type="l", main=expression(paste("Effect of",
vnames[j],"on",vnames[i])), xlab="Lags (quarters)", ylab="Response")

The title appears as "Effect of vnamesj on vnamesi". Without the function
"expression" title for j=1 and i=2 appears as "Effect of pi on y". The
desired outcome would be return the word "pi" rather than a Greek letter.

Is there any simple way to overcome this situation.

Thank you
Ahmad Abu Hammour
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