read.csv,坑爹,老报错
> a1=read.csv("communitty_add2.csv",sep=',',header=T,fileEncoding="UTF-8",encoding="UTF-8") Warning messages: 1: In read.table(file = file, header = header, sep = sep, quote = quote, : 输入链结'communitty_add2.csv'内的输入不对 2: In read.table(file = file, header = header, sep = sep, quote = quote, : incomplete final line found by readTableHeader on 'communitty_add2.csv'
原因是最后一行的结尾不是EOL(End of line)字符,所以R提醒你数据是不是不完全。
在文件的最后一行加个回车有时能解决。
网上一堆方法,都不管用, read.table也不行
用xlsx包
> library(xlsx) 载入需要的程辑包:rJava 载入需要的程辑包:xlsxjars > a1 <- read.xlsx("a.xlsx", 1)搞定