Hi, I have created a dataframe (lets call is df) that contains the following variables
"Dependent1" "Dependent2" Dependent3" "Independent1" I want to do the following regressions: z<- glm( df$Dependent1 ~ df$Independent1) z<- glm( df$Dependent2 ~ df$Independent1) z<- glm( df$Dependent3 ~ df$Independent1) and so on I wanted to put this in a for loop e.g. for (i in 1:3) { z<- glm( df$ColumnName_i ~ df$Independent1) print(z) } How do I specify the column name in the regression above for the dependent variable [[alternative HTML version deleted]] ______________________________________________ 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.