Reproducible example:
columnA <- c(1:10)
columnB <- c("A","A","B","B","B","B","C","D","D","D")
df <- data.frame(columnA,columnB)
colBtable <- sort(table(df$columnB),decreasing=T)
write.table(colBtable,"colB.csv",col.names = FALSE)
This works, and does what I want it to do (ie: make a CSV file that says B 4, D 3, C 2, A 1).
However, with my (rather large) data set, I get the error:
Error in data.frame(x) : invalid multibyte string 360
There are several "invalid multibyte string" type errors on Stack Overflow, and I've tried some of the solutions. These also give errors, such as:
argumemt is not a character vector
or
invalid multibyte string 1880
I suspect this is because there are special characters in my data. Any suggestions on how to resolve these errors?
