Re: [R-sig-Geo] Variables inside a for

2008-12-01 Thread Roger Bivand
On Mon, 1 Dec 2008, Gabor Grothendieck wrote: Use this: lm(database[c(variable[i], "INCOME")]) On Mon, Dec 1, 2008 at 7:45 PM, Raphael Saldanha <[EMAIL PROTECTED]> wrote: Hi! I had a database with some variables in sequence. Let me say: TX01, TX02, TX03 and TX04. But I need to run some regr

Re: [R-sig-Geo] Variables inside a for

2008-12-01 Thread Frede Aakmann Tøgersen
ce> If you have received this e-mail in error please contact the sender. From: [EMAIL PROTECTED] on behalf of Raphael Saldanha Sent: Tue 02-12-2008 01:45 To: r-sig-geo@stat.math.ethz.ch; [EMAIL PROTECTED] Cc: Ana Paula Sobral Subject: [R-sig-Geo] Variables ins

Re: [R-sig-Geo] Variables inside a for

2008-12-01 Thread Gabor Grothendieck
Use this: lm(database[c(variable[i], "INCOME")]) On Mon, Dec 1, 2008 at 7:45 PM, Raphael Saldanha <[EMAIL PROTECTED]> wrote: > Hi! > > I had a database with some variables in sequence. Let me say: TX01, TX02, > TX03 and TX04. > > But I need to run some regressions changing the variables... so: >

Re: [R-sig-Geo] Variables inside a for

2008-12-01 Thread Fernando Miguez
Hi Raphael, If you truly only need to run 4 regressions you might be less confused if you just do test1 <- lm(TX01 ~ INCOME, data = database) test2 <- lm(TX02 ~ INCOME, data = database) test3 <- lm(TX03 ~ INCOME, data = database) test4 <- lm(TX04 ~ INCOME, data = database) If you need to do t

[R-sig-Geo] Variables inside a for

2008-12-01 Thread Raphael Saldanha
Hi! I had a database with some variables in sequence. Let me say: TX01, TX02, TX03 and TX04. But I need to run some regressions changing the variables... so: variable <- paste("TX0", 1:4, sep="") for(i in 1:4){ test[i] <- lm(variable[i] ~ INCOME, data=database) } But doesn't work... lm tries t