[R] numerical subscripts in a loop in a plot

Eik Vettorazzi E.Vettorazzi at uke.uni-hamburg.de
Mon Feb 1 18:51:45 CET 2010


Hi Alexander,
there is a simple solution using bquote
for(i in 1:10){
   text(i, 0,bquote(epsilon[.(i)]))
}

hth.


Alexander Nervedi schrieb:
> Hi R Graphics Gurus
>
> I am unable to figure out this issues with unevaluated expressions. I'm trying to create a graphic where I calculate the residual from a regression and want to mark each residual with its observation number. So something like
>
> plot(0,0, type = "n", xlim = c(0,10))
> for(i in 1:10){
>    text(i, 0, substitute(paste(epsilon[i])))
>    
> }
>
> except that i end up pasting \epsilon_i 10 times and not \epsilon_1, ..., \epsilon_10. i'd be much obliged if anyone can put me out of my misery and let me know how i am goofing up.
>
> many thanks
>  		 	   		  
> _________________________________________________________________
>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>   

-- 
Eik Vettorazzi
Institut für Medizinische Biometrie und Epidemiologie
Universitätsklinikum Hamburg-Eppendorf

Martinistr. 52
20246 Hamburg

T ++49/40/7410-58243
F ++49/40/7410-57790



More information about the R-help mailing list