Error "Incorrect Multibyte Characters" When Attempting to Load CSV

Asked 2 years ago, Updated 2 years ago, 63 views

When I create simple data in CSV format (UTF-8) in Excel (the first line is alphanumeric) and try to read it in R with read.csv("filename", header=T)

Error in
make.names(col.names, unique=TRUE): 
   '<ef>sa<bf>area' contains invalid multi-byte characters 
> 

The error appears.
I checked and found that there was an encoding problem, but the conditions should have been met because it was in UTF-8 format, but it didn't work.

I would appreciate it if you could tell me how to solve it.

r csv

2022-09-30 21:22

1 Answers

Specify the encoding explicitly.

read.csv("filename", header=T, fileEncoding="utf-8")

-- metropolis's From Comments.


2022-09-30 21:22

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.