2018-11-07
閱讀量:
2728
R里關(guān)于文件讀取的問題
文件讀入錯(cuò)誤:
> read.csv(file="D:\\Data\\rd\\01.csv",header=TRUE)
錯(cuò)誤于make.names(col.names, unique = TRUE) :
??'<ff><fe><53>'多字節(jié)字符串有錯(cuò)
此外: 警告信息:
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就出錯(cuò),why?
因?yàn)樵撐募?假的CSV 格式文件
為了擺顯下(或者說不迷信什么后綴名), 就按照你的“誤判”格式,進(jìn)行讀取的。 readLines, 打開記事本等等 發(fā)現(xiàn) 是TAB 分開的,以及編碼都有可能有問題。 就嘗試了編碼變化。
當(dāng)然最實(shí)際的 做法是, 既然是 假的 CSV 格式文件, 可以變真的 CSV文件, 比如 EXCEL 另存為 csv格式就應(yīng)該可以??讀取了。






評(píng)論(0)


暫無數(shù)據(jù)
CDA考試動(dòng)態(tài)
CDA報(bào)考指南
推薦帖子
0條評(píng)論
0條評(píng)論
0條評(píng)論