Skip to content
Prev 25357 / 398502 Next

using the function "expression" with "paste" in a plot

"Ahmad Abu Hammour" <hammour at msn.com> writes:
Yes. Use substitute()

main=substitute(paste("Effect of", foo, "on", bar),
     list(foo=vnames[j], bar=vnames[i]))

If you want the Greek letters rather than the names, use

main=substitute(....
     list(foo=as.name(vnames[j]), bar=as.name(vnames[i])))

or perhaps something like

vnames <- expression(pi, y, delta)
plot(....
main=substitute(paste("Effect of", foo, "on", bar),
     list(foo=vnames[[j]], bar=vnames[[i]]))
)