Use bquote(), as in
  n <- 200
  titt <- bquote(paste("R con ventanas de ", .(n), " ", italic(datos)))
or, using ~ instead of paste(),
  titt <- bquote("R con ventanas de " ~ .(n) ~ italic(datos))
  plot(1, 1, main=titt) 

The notation .(xxx) means to replace xxx by the value of the variable called 
"xxx".

You can also use bquote() instead of expression in the simple (no variables) 
case.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com


> -----Original Message-----
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
> Behalf
> Of Jose Narillos de Santos
> Sent: Monday, April 01, 2013 12:46 PM
> To: r-help
> Subject: [R] expression
> 
> Hi all,
> 
> I´m using
> 
> 
> titt<- expression(paste("R con ventanas de 200 ", italic(datos)))
> 
> And it works properly on a plot(...,main=titt,..)
> 
> But if I want to add an improvement to avoid typing n on the plot so that
> 
> n<-200
> 
> titt<- expression(paste("R con ventanas de ",n,  italic(datos)))
> 
> It doesn´t recognize that n is a "variable" and adds "n" letter instead of
> 200 on the plot when run:
> 
> plot(...,main=titt,..)
> 
> How can I include n in the plot authomatically without loosing the italic
> letter?
> 
>       [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to