Problem importing csv file in R

Dear,
When importing my CSV file, I received this error message: Error in make.names(x) : invalid multibyte string 1. I would like to know what it means and what to do to solve it.

It seems that the header row contains a character that cannot be interpreted. You could try looking at the file with plain text editor to see if you can find it. If you cannot find the problem, you could try just changing the column names and see if the problem goes away.

This is an encoding problem. Try to convert your file encoding to UTF8 and read again.

The following R code should do the convert

writeLines(iconv(readLines(file_path), from = "some encoding", to = "UTF-8"), file(file_path, encoding = "UTF-8"))

file_path being your file location, and "some encoding" being the original encoding of your file.

Many thanks for your valuable contribution. You're right: I have saved my excel file in CSV UTF-8 format and it works.

Many thanks for your valuable contribution. I should have saved my excel file in CSV UTF-8 format but CSV. I used CSV UTF-8 format and it works.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.