【发布时间】:2018-08-11 22:29:40
【问题描述】:
我正在运行以下代码...
#Create a list of all the files
file.list <- list.files(path="~/R/natural-language-processing/class-notes", pattern=".csv")
#Loop over file list importing them and binding them together
D1 <- do.call("rbind",lapply(file.list, read.csv, header = TRUE, stringsAsFactors = FALSE))
这是我在上面运行do.call 行时遇到的错误。
文件中的错误(文件,“rt”):无法打开连接
我已尝试重置我的 wd。我现在的getwd() 是
~/R/natural-language-processing
我看过另一个
文件错误(文件,“rt”):无法打开连接
【问题讨论】:
-
路径好像不正确。尝试删除波浪号。
-
这些更改仍然出现同样的错误。
file.list <- list.files(path="C:/Users/Bob/Documents/R/natural-language-processing/class-notes", pattern=".csv")getwd()是"C:/Users/Bob/Documents/R/natural-language-processing" -
只是为了检查这个路径是否正确。删除模式并查看是否获得目录中的文件列表。
-
模式被删除,我仍然在目录中得到相同的文件列表。
-
在
list.files中使用full.names = TRUE
标签: r read.table read.csv