I am working with panel data in R, and I want to run a two way panel fixed effects model on my data set so I used plm:
plm1 <- plm(rprofit_acre~dd89+prcp_0410, data=data, effect="twoways", model="within")
and I am getting the error message
"Error in pdim.default(index[[1L]], index[[2L]]) : duplicate couples (id-time)"
I used the suggestion in the error message to see if there are any duplicates of state+year combination with the line
any(table(data$state,data$year)!=1)
and the result was TRUE, meaning that there aren't any duplicates of state+year combination.