[R] text-plotting math & regular mixed ?

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Tue Jun 29 16:55:06 CEST 1999


Martin Maechler <maechler at stat.math.ethz.ch> writes:

> i.e., can you ``fix'' the following function ?
> 
> p.ex <- function(alpha = .05) {
> 
>      x <- seq(0,1, len=101)
>      ch.a <- formatC(alpha,wid=1)
>      plot(x, x^alpha, main= 
> 	  expression(paste("Power plot of ", x ^ alpha, " for ", alpha == {})))
>      ## Where can I pass  ch.a ??			  
>      invisible()			  
> }

Use substitute(). Something like 

e<-substitute(expression(paste("Power plot of ", x ^ alpha, " for ",
alpha == ch.a)), list(ch.a=formatC(alpha,wid=1)))

plot(x, x^alpha, main=e)

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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