I'm a beginner with R, so bear with me. I've spent a while trying to fix this issue based on earlier answers, but I can't work it out.
I want to run a panel regression using the plm package. However, when I try code of the form reg<-plm(y ~ x1, x2, x3, data=mydataframe, index=c('region', 'year'), model='within')
it gives the error
Error in .rowNamesDF<-(x, value = value) :
duplicate 'row.names' are not allowed
In addition: Warning message:
non-unique values when setting 'row.names': ‘10’, ‘11’, ‘14’, ‘2’, ‘3’, ‘4’, ‘5’, ‘6’, ‘7’, ‘8’, ‘9’
I can't figure out why it says I have duplicate row names. I've tried some of the suggestions made by other people, such as checking anyDuplicated(row.names(mydataframe))
- which tells me there are no duplicated row names - or make.names(mydataframe, unique=TRUE
- which doesn't fix the problem.
The data looks like this
ï..region id year grpmlnr grppc cpi
1 RegionA 1 1998 18245.5 12242.8 167.7
2 RegionA 1 1999 32060.6 21398.0 140.8
3 RegionA 1 2000 42074.5 27969.5 120.9
Any suggestions?
Thank you very much in advance, I'm aware it's a dumb question but I really need help.
Maurits