I have 7 1-factor logistic regression models that I have fitted using GLM (stored in model1 to model7). For each model, I want to extract their coefficient and store in "coeffs" vector well as the p-value to be stored in "p-values" vector. I tried using loops in R but I am getting the following error-Error: $ operator is invalid for atomic vectors
.
How can I loop this to get vectors having coefficient and p-values for each model?
Here is my code-
coeffs<-c()
p_values<-c()
for (x in c(model1,model2,model3,model4,model5,model6,model7)) {
coeffs <- summary(x)$coefficients[2,1]
p_values <- summary(x)$coefficients[2,4]
}