R read.csv stopped working after switching to a new computer

43 views Asked by At

I have R scripts that have worked years in RStudio environment, that I regularly use as we get new data. One of the first task this script does is to read multiple csv files stored in a folder. When I use this script this week, I get the following error message:

"Error in type.convert.default(data[[i]], as.is = as.is[i], dec = dec, : invalid multibyte string at 'ahu'"

The script that gets this error message is as follows:

files <- list.files(pattern = "*.csv")

compiled <- do.call(rbind, lapply(files, function(x) read.csv(x, sep = ',', strip.white = TRUE, na.strings = c(""," ","N/A", "NA", "(Blanks)","NULL", "---", "-", "#NAME?"), col.names = the.header, stringsAsFactors = FALSE)))

The scripts were working last months, and I ran them without adding new files but come back with the same error. I saw some articles on adding encoding parameter, but doing brought me more issues, which include also crashing of RStudio. The characters in the files are of European languages.

The only difference between last month and this month is that I got a new computer from our IT. We installed R and RStudio and imported these scripts into my c-drives (so they are the most recent version from two weeks ago). Other scripts were working. Is there anyone who knows a change of computer might introduce these types of errors, and how to fix the issues?

Thank you very much for your help!

Miyako

0

There are 0 answers