啊啊啊啊啊吖

2018-11-07   阅读量: 2015

数据分析师 R语言

R里关于文件读取的问题

扫码加入数据分析学习群

文件读入错误:

> read.csv(file="D:\\Data\\rd\\01.csv",header=TRUE)
错误于make.names(col.names, unique = TRUE) :
  '<ff><fe><53>'多字节字符串有错
此外: 警告信息:
1: In read.table(file = file, header = header, sep = sep, quote = quote,  :
  line 1 appears to contain embedded nulls
2: In read.table(file = file, header = header, sep = sep, quote = quote,  :
  line 2 appears to contain embedded nulls
3: In read.table(file = file, header = header, sep = sep, quote = quote,  :
  line 3 appears to contain embedded nulls
4: In read.table(file = file, header = header, sep = sep, quote = quote,  :
  line 4 appears to contain embedded nulls
5: In read.table(file = file, header = header, sep = sep, quote = quote,  :
  line 5 appears to contain embedded nulls
>

把csv表格header行删除后就能读入,但保留header就出错,why?

因为该文件是 假的CSV 格式文件

为了摆显下(或者说不迷信什么后缀名), 就按照你的“误判”格式,进行读取的。 readLines, 打开记事本等等 发现 是TAB 分开的,以及编码都有可能有问题。 就尝试了编码变化。

当然最实际的 做法是, 既然是 假的 CSV 格式文件, 可以变真的 CSV文件, 比如 EXCEL 另存为 csv格式就应该可以  读取了。

添加CDA认证专家【维克多阿涛】,微信号:【cdashijiazhuang】,提供数据分析指导及CDA考试秘籍。已助千人通过CDA数字化人才认证。欢迎交流,共同成长!
0.0000 0 5 关注作者 收藏

评论(0)


暂无数据

推荐课程

推荐帖子