Hi, I am running through a series of regression in a loop as follows:
results <- vector("list", length(mydata$varnames)) for (i in 1:length(mydata$varnames)) { results[[i]] <- summary(lm(log(eval(parse(text=varnames[i]))) ~ age + sex + CMV.status, data=mydata)) } Now, when I look at the results[i]] objects, I won't be able to see the original variable names. Obviously, I will only see the following: Call: lm(formula = log(eval(parse(text = varnames[i]))) ~ age + sex + CMV.status, data = mydata) Is there a way to display the original variable names on the LHS? In addition, is there a better paradigm for doing these type of series of regressions in an automatic fashion? Thank you very much, Ravi Ravi Varadhan, Ph.D. (Biostatistics), Ph.D. (Environmental Engg) Associate Professor, Department of Oncology Division of Biostatistics & Bionformatics Sidney Kimmel Comprehensive Cancer Center Johns Hopkins University 550 N. Broadway, Suite 1111-E Baltimore, MD 21205 410-502-2619 [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.