Search code examples
rcsv

Error while reading csv file in R


I am having some problems in reading a csv file with R.

 x=read.csv("LorenzoFerrone.csv",header=T)

Error in make.names(col.names, unique = TRUE) : 
      invalid multibyte string at '<ff><fe>N'

I can read the file using libre office with no problems.

I can not upload the file because it is full of sensible information.

What can I do?


Setting encoding seem like the solution to the problem.

> x=read.csv("LorenzoFerrone.csv",fileEncoding = "UCS-2LE")
> x[2,1]
[1] Adriano Caruso
100 Levels:  Ada Adriano Caruso adriano diaz Adriano Diaz alberto ferrone Alexey ... Zia Tina

Solution

  • You need to specify the correct delimiter in the sep argument.