# [R] numerical subscripts in a loop in a plot

David Winsemius dwinsemius at comcast.net
Mon Feb 1 18:59:19 CET 2010

On Feb 1, 2010, at 12:40 PM, Alexander Nervedi wrote:

>
> 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])))
>
> }

Does this work for you:

plot(0,0, type = "n", xlim = c(0,10))
for(i in 1:10){
text(i, 0, substitute(epsilon[i], list(i=i) ))

}

It doesn't for me, in that it doe not print the correct epsilon glyph,
but that's because my access to the Symbol font is messed up on my Mac
for a reason that is not pressing enough to warrant a question to the
appropriate help list. It does get the subscripts printing correctly
beneath empty square boxes.

>
> 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.

David Winsemius, MD
Heritage Laboratories
West Hartford, CT