Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/64.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
错误:";在..中意外输入“;尝试使用read.csv()读取csv文件时_R - Fatal编程技术网

错误:";在..中意外输入“;尝试使用read.csv()读取csv文件时

错误:";在..中意外输入“;尝试使用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

我试图将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:/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”
。并使用引号,正如盖恩斯所提到的。