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