Re: [R] use expression() in a loop

2008-08-18 Thread Henrik Bengtsson
...or use the more generic substitute() to replace parts of an expression, e.g. i <- 3; xlab1 <- substitute(g[idx], list=list(idx=i)); xlab2 <- bquote(g[.(i)]); stopifnot(identical(xlab1, xlab2)); /Henrik On Mon, Aug 18, 2008 at 3:18 PM, Marc Schwartz <[EMAIL PROTECTED]> wrote: > on 08/

Re: [R] use expression() in a loop

2008-08-18 Thread Marc Schwartz
on 08/18/2008 05:00 PM Nanye Long wrote: > 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.

Re: [R] use expression() in a loop

2008-08-18 Thread Sundar Dorai-Raj
Nanye Long said the following on 8/18/2008 3:00 PM: 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

[R] use expression() in a loop

2008-08-18 Thread Nanye Long
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. N