我尝试在 R 中扫描数据。 我的代码:
scan("D:\\Projekt1\\Lauf.dat",sep=",")
我的数据内容:
10.2, 11.4, 10.5, 9.8, 9.9, 9.9, 10.3, 10.8, 10.2, 11.5, 10.0, 11.4, 11.2, 10.1, 10.5, 12.0, 11.4, 10.2, 10.1, 12.1
预期输出:
[1] 10.2 11.4 10.5 9.8 9.9 9.9 10.3 10.8 10.2 11.5 10.0 11.4 11.2 10.1 10.5
[16] 12.0 11.4 10.2 10.1 12.1
但是我收到了这个错误:
Warning in file(file, "r") : cannot open file '': Invalid argument
Error in file(file, "r") (main.R#1): cannot open the connection Show stack trace
我做错了什么?我希望你能帮助我。
BR 马可
最佳答案
尝试用以下代码替换您的代码:
setwd("D:\\Projekt1")
scan("Lauf.dat",sep=",")
编辑-1:
setwd("D:/Projekt1") #使用正斜杠
关于r - 为什么R不扫描数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61168091/