[R] math-type label

Uwe Ligges ligges at statistik.tu-dortmund.de
Tue Sep 16 11:51:28 CEST 2008



Ardia David wrote:
> Dear all,
> I would like to create a math-type label like this one:
> 
> c(expression(theta[1]), expression(theta[2]), ..., expression(theta[N]))


Example:


plot(1:10, xaxt="n")
here <- 1:10
axis(1, at = here,
     do.call("expression",
         lapply(here, function(j)
             substitute(theta[i], list(i=j)))))


Uwe Ligges


> How can I do that in an automatic way (i.e., for any dimension N). I 
> tried with a "for" loop, but also need to used substitute I guess. Any 
> idea?
> Thanks a lot,
> David
> 
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list