An error occurs when R tries to read csv data.How can we solve this problem?

Asked 2 years ago, Updated 2 years ago, 72 views

data<-read.csv("try.csv", header=T)
make.names(col.names, unique=TRUE)

Error in : 'Sano' contains invalid multi-byte characters
appears.For character encoding,

data<-read.csv("try.csv", header=T, fileEncoding="utf-8")

If so, an error will also cause an error.How do I resolve this?

r csv

2022-09-30 21:24

1 Answers

You can explicitly convert the CSV file to UTF-8 using a text editor, or specify fileEncoding="CP932" if your environment is MacOS.


2022-09-30 21:24

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.