My code is as shown below and has been running fine for months:
The first part is appending data to dfCampaignTask and this is running fine
for (i in files) {
if (startsWith(i, "CampaignTaskReport_2")) {
temp <- read.csv(paste(directory, i, sep = ""), header = TRUE)
names(temp) <- names(dfCampaignTask)
dfCampaignTask <- rbind(dfCampaignTask, temp)
}
else if (startsWith(i, "CombinedReport_2")) {
temp <- read.csv(paste(directory, i, sep = ""), header = TRUE)
if (ncol(temp) < 19) {
names(temp) <- dfCombinedNamesOld
}
else {
names(temp) <- names(dfCombined)
}
dfCombined <- bind_rows(dfCombined, temp)
}
}
The second part which is appending data to dfcombined is throwing an error: Can't combine ..1$Activity ID and ..2$Activity ID <factor<2585d>>.
I checked str of all combined files in the folder and activity ID column is all factor so not sure what's causing the discrepancy