[R] expressions and paste

Emily Baldock emily.baldock at ctsu.ox.ac.uk
Thu Nov 11 17:31:10 CET 2004

I have written a function to plot data which will be used for various different chemistries.
A simplified version is:
plot_data <- function(risk,levels,chem,sd2,measure){
  plot(risk, levels,main=paste ("per", sd2, measure, "\n in usual", chem))
The problem is with the title.
This works fine if the variable "chem" is just text, but if it is an expression then obviously it won't work.
I have experimented with various things and I am at a complete loss for how to insert an expression into the middle of 
a title.
If the expression was going in directly I would use main=expression(paste("text ", expression, " text")) but again this 
doesn't work.
Can anyone help?

More information about the R-help mailing list