So I have data that is really wide, and so I am reshaping the data to long so that it can be analyzed, the data is not hierarchical and its really way to complicated to give you guys a working example so I know that it is going to be tough to answer.
Anyway, I need to reshape it three consecutive times.
longdata = reshape(widedata,direction="long",varying=Issue,idvar = "Issue.ID")
longdata = reshape(longdata,direction="long",varying=Resolution)
longdata= reshape(longdata,direction="long", varying=Equipment)
It works the first two times, and the data that is being reshaped in the third line is set up the exact same way as the first two, so its not that there is something weird with that vector, i can change the order and it still throws this error on the third reshape.
Error in `row.names<-.data.frame`(`*tmp*`, value = paste(ids, times[i], :
duplicate 'row.names' are not allowed
I have tried getting rid of the row names like so:
longdata = reshape(widedata,direction="long",varying=Issue,idvar = "Issue.ID")
rownames(longdata) <- NULL
longdata = reshape(longdata,direction="long",varying=Resolution)
rownames(longdata) <- NULL
longdata= reshape(longdata,direction="long", varying=Equipment)
but still get the same error. what do I need to do in order for this to work?
EDIT*
I'm gonna try and give some sample data, it will probably be a really long post now, sorry.
Issue.ID = c("CBICR1Q2201704000", "CBICR1Q2201704001",
"CBICR1Q2201704002", "CBICR1Q2201704003", "CBICR1Q2201704004",
"CBICR1Q2201704005", "CBICR1Q2201704006", "CBICR1Q2201704007",
"CBICR1Q2201704008", "CBICR1Q2201704009", "CBICR1Q2201704010",
"CBICR1Q2201704011", "CBICR1Q2201704012", "CBICR1Q2201704013",
"CBICR1Q2201704014", "CBICR1Q2201704015", "CBICR1Q2201704016",
"CBICR1Q2201704017", "CBICR1Q2201704018", "CBICR1Q2201704019")
Issue.1 = c("Difficulty receiving products in general",
"Supplier compliance issues", "Supplier fraud, waste, or abuse",
"Difficulty receiving products in general", "Difficulty receiving products in general",
"Supplier fraud, waste, or abuse", "Supplier service issues",
"Problems repairing due to service issues ", "Problems repairing due to service issues ",
"Other", "Billing, coverage, coordination of benefits", "Problems repairing due to service issues ",
"Difficulty receiving products in general", "Difficulty receiving products in general",
"Low quantity/quality", "Difficulty receiving products in general",
"Difficulty receiving products in general", "Supplier service issues",
"Problems repairing due to service issues ", "Problems repairing due to service issues ")
Issue.2 = c("Supplier compliance issues", "Billing, coverage, coordination of benefits",
"Supplier service issues", "Supplier service issues", "Low quantity/quality", NA, "DMEPOS information issues", "Supplier fraud, waste, or abuse",
"Supplier compliance issues", NA, "DMEPOS information issues",
"Supplier compliance issues", "Supplier compliance issues", "Supplier service issues",
"Supplier service issues", "Supplier service issues", "Supplier service issues",
"DMEPOS information issues", NA, "Supplier compliance issues")
Equipment.1 = c("Oxygen Supplies/Equipment",
"Continuous Positive Airway Pressure (CPAP) / Respiratory Assist Device (RAD)",
"Nebulizers", "Lifts", "Oxygen Supplies/Equipment", "Walking Aids",
"Power Mobility Devices (PMDs) other than scooter", "Power Mobility Devices (PMDs) other than scooter",
"Continuous Positive Airway Pressure (CPAP) / Respiratory Assist Device (RAD)",
"Continuous Positive Airway Pressure (CPAP) / Respiratory Assist Device (RAD)",
"Continuous Positive Airway Pressure (CPAP) / Respiratory Assist Device (RAD)",
"Walking Aids", "Hospital beds", "Power Mobility Devices (PMDs) other than scooter",
"Oxygen Supplies/Equipment", "Hospital beds", "Oxygen Supplies/Equipment",
"Continuous Positive Airway Pressure (CPAP) / Respiratory Assist Device (RAD)",
"Power Mobility Devices (PMDs) other than scooter", "Power Mobility Devices (PMDs) other than scooter"
)
Equipment.2 = c(NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_)
Resolution.1 = c("Current supplier resolved the issue",
"Current supplier resolved the issue", "Current supplier resolved the issue",
"Supplier educated about inquiry\n", "Beneficiary educated about inquiry ",
"Supplier educated about inquiry\n", "Beneficiary educated about DMEPOS\n",
"Beneficiary educated about inquiry ", "Beneficiary educated about inquiry ",
"Beneficiary educated about inquiry ", "Beneficiary educated about suppliers",
"The case unresolved ", "The case unresolved ", "Beneficiary educated about DMEPOS\n",
"Current supplier resolved the issue", "Current supplier resolved the issue",
"Beneficiary educated about DMEPOS\n", "Beneficiary educated about suppliers",
"New supplier found ", "Beneficiary educated about suppliers"
)
Resolution.2 = c(NA, NA, NA, "Current supplier resolved the issue",
NA, "Reimbursement or refund ", "Supplier educated about DMEPOS_x000D_\n",
"Beneficiary educated about suppliers", "Beneficiary educated about DMEPOS\n",
"Current supplier resolved the issue", "New supplier found ",
"Beneficiary educated about DMEPOS\n", NA, "Beneficiary educated about suppliers",
"Beneficiary educated about inquiry ", "Supplier educated about inquiry_x000D_\n",
"Beneficiary educated about inquiry ", "New supplier found ",
NA, "Supplier educated about inquiry\n")
widedata<-data.frame(Issue.ID,Issue.1,Issue.2,Resolution.1,Resolution.2,Equipment.1,Equipment.2)
Issue <- c("Issue.1","Issue.2")
Equipment <- c("Equipment.1","Equipment.2")
Resolution <- c("Resolution.1","Resolution.2")