I have a df that looks like this:
Country Year X Y1 Y2 Y3 Y4
ARG 1990 0.4875 1.23 2.51 1.42 4.85
ARG 1991 0.4952 1.66 2.31 1.25 5.02
ARG 1992 0.5120 1.87 2.57 1.92 4.66
ARG 1993 0.5213 1.96 2.41 2.42 5.85
Where X is my independent variable and Ys are the dependent variables I want to loop on.
I tried something like:
for (i in out_start:out_end){
outcome = colnames(RegTest)[i]
model <- plm(get(outcome) ~ X, data=RegTest, index=c("Country", "year"), model= "within")
summary(model)
}
Where I previously set out_start at 4 and end at the end of my columns but I get an error message saying:
Error in uniqval[as.character(effect), , drop = F] :
incorrect number of dimensions
I can't see what is wrong since it seems to get correctly the name of the column.
PS: if someone knows also how to list all summaries in one df it would be super helpful.