I'm attempting to run a random effects regression on panel data, but i receive the error message:
Error in .rowNamesDF<-
(x, value = value) :
duplicate 'row.names' are not allowed
In addition: Warning message:
non-unique values when setting 'row.names': ‘3-2016’, ‘3-2017’, ‘3-2018’, ‘3-2019’, ‘4-2015’, ‘4-2016’
This has happened since I've used
df$ID <- as.numeric(as.factor(df$Team))
to generate IDs for each NBA team. Previously I was using a very ramshackle approach where I exported the dataset to excel using xlsx, manually entered the IDs in and then imported the new data set. But now, even when I try the old method i receive the same error code.
This is the command I use to put the data in panel data format:
pdata <- pdata.frame(df, index=c("ID","Year"))
When I use table(index(pdata), useNA = "ifany")
all columns from 2015-2019 are all 1s
ID 2015 2016 2017 2018 2019
1 1 1 1 1 1
2 1 1 1 1 1
3 1 1 1 1 1
4 1 1 1 1 1
5 1 1 1 1 1
.
.
.
I've tried to be as descriptive as possible, I'm sorry if this is formatted strange or lacks vital information, I'm not a programmer by schooling, and my major only uses Stata for regression analysis.