错误:";在..中意外输入“;尝试使用read.csv()读取csv文件时
我试图将csv文件读入R,但总是收到相同的错误消息错误:";在..中意外输入“;尝试使用read.csv()读取csv文件时,r,R,我试图将csv文件读入R,但总是收到相同的错误消息 Error: unexpected input in "read.csv(C:\"... 这是我的密码: read.csv(C:\Users\hp\Documents\dataset_self_reports_of height., header = TRUE, sep = ",") 这是因为假定文件参数为字符串 你真的有 C:\Users\hp\Documents\dataset\u self\u高度报告 应该是什么时候 “C:/Us
Error: unexpected input in "read.csv(C:\"...
这是我的密码:
read.csv(C:\Users\hp\Documents\dataset_self_reports_of height., header = TRUE, sep = ",")
这是因为假定
文件
参数为字符串
你真的有
C:\Users\hp\Documents\dataset\u self\u高度报告
应该是什么时候
“C:/Users/hp/Documents/dataset\u self\u reports\u height”
同样在R\
中,需要以这种方式使用/
因此您最有可能这样使用它:
read.csv(“C:/Users/hp/Documents/dataset\u self\u reports\u height”,header=TRUE,sep=“,”)
我建议您阅读一些R教程,了解R的工作原理。使用反斜杠时,您需要将它们加倍或使用正斜杠:
“C:\\Users\\hp\\Documents\\dataset\u self\u reports\u of height”
或“C:/Users/hp/Documents/dataset\u self\u reports\u of height”
。并使用引号,正如盖恩斯所提到的。