简体   繁体   English

如何在RStudio中导入带有中文字符的大型csv数据

[英]How to import large csv data with Chinese characters in RStudio

I want to import data.csv with Chinese characters by RStudio , but it fails (see below ). 我想导入data.csv有中国特色的RStudio,但它失败(见下文)。 So I want to open the file to figure what's wrong with the data by excel, but the file is too large to open (470M). 所以我想打开文件以查看excel数据出了什么问题,但文件太大而无法打开(470M)。 What should I do? 我该怎么办?

dat <- read.csv("data.csv",header=T,encoding = "UTF-8",stringsAsFactors = F)

Error in make.names(col.names, unique = TRUE) : 多字节字符串1有错 make.names(col.names,唯一= TRUE)中的错误:多字节字符串1有错

I found a solution: Split the large file into several parts by Free Huge CSV Splitter. 我找到了一个解决方案:使用Free Huge CSV Splitter将大文件分成几个部分。 Open the small file by excel, and save as CSV UTF-8 format. 用excel打开小文件,并另存为CSV UTF-8格式。 Then imported to RStudio sucessfully. 然后成功导入到RStudio。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM