[R] substitution in expression

Uwe Ligges ligges at statistik.uni-dortmund.de
Mon Sep 6 17:26:21 CEST 2004


Adaikalavan Ramasamy wrote:

> I have been struggling with this problem for a while and I hope someone
> could help me. Or if someone could point me to a section in the manual I
> would be grateful.
> 
>  x <- "my"
>  plot(1:10, main=expression(paste( x, Delta, "values" )))
> 
> Q : How do I get the title to say "my (triangle symbol) values" ?


plot(1:10, main = substitute(y * " " * Delta * " values", list(y = x)))

Uwe Ligges



> 
> The following trial-and-error produced mainly errors :
> 
>  plot(1:10, main=expression(paste( get(x), Delta, "values" ))) 
>  plot(1:10, main=expression(paste( substitute(x), Delta, values )))
>  plot(1:10, main=expression(paste( deparse(x), Delta, "values" )))
>  plot(1:10, main=paste(x, expression(Delta), "values"))
>  plot(1:10, main=paste(x, eval(expression(Delta)), "values"))
>  plot(1:10, main=paste(x, expression(Delta, "values" )))
>  plot(1:10, main=paste(x, expression(paste(Delta, "values" ))))
> 
> Many thanks.
> 
> Regards,




More information about the R-help mailing list