[R] use expression() in a loop

Nanye Long nanye.long at gmail.com
Tue Aug 19 00:00:59 CEST 2008


Hi all,

I want to do plot() in a loop to make 10 graphs, so I have some code like

for (i in 1:10) {
   plot(... ... , xlab = expression(g[i]) )
}

I expect g_1, g_2, and so on appear on x labels, but it simply prints
g_i for each graph. Does anybody know how to get around this problem?
Thanks.

NL



More information about the R-help mailing list