How about doing something like: x <- 1:100 y1 <- 1 + 2*x + rnorm(x) y2 <- 2 + 3*x + rnorm(x) lm(cbind(y1,y2) ~ x)
This is much faster. Yours sincerely / Venlig hilsen Frede Aakmann Tøgersen Statistician, M.Sc., Ph.D. Modeling, Statistics and Risk Analysis Wind and Site Competence Centre Technology R&D T: +45 9730 5135 M: +45 2547 6050 [EMAIL PROTECTED] Company reg. name: Vestas Wind Systems A/S.. This e-mail is subject to our e-mail disclaimer statement. Please refer to www.vestas.com/legal/notice <http://www.vestas.com/legal/notice/owww.vestas.com/legal/notice> 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: [EMAIL PROTECTED]; r-help@r-project.org Cc: Ana Paula Sobral Subject: [R-sig-Geo] Variables inside a for 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 to find a variable inside database named variable[i] ... Suggestions? King regards! Raphael Saldanha Brasil [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list [EMAIL PROTECTED] https://stat.ethz.ch/mailman/listinfo/r-sig-geo ______________________________________________ R-help@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.