Dear R users,
I'm a new user to R and have a data set consisting of a number of variables (in
a data frame). I wish to carry out a regression analysis of the first variable
against all the rest in turn. I have used the following code to do this
dd<-read.table("for loop.txt",header=T)
for (j in 2:5) print(summary(lm(formula = dd[,1] ~ dd[,j])))
However, although it produces all the analyses that I want, the output is
annotated with dd[,1] and dd[,j] rather than the actual variable names. Is
there any way around this?
Best wishes,
Alan.
______________________________________________
[email protected] 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.