【发布时间】:2017-01-06 05:25:29
【问题描述】:
您好,我正在尝试从将要更新/添加到的文件夹中创建包含多个 .csv 文件的单个数据框。
我在这里找到了以前的答案,但是我遇到了一个相当简单的错误
read.table 中的错误(file = file,header = header,sep = sep,quote = quote,: 'file' 必须是字符串或连接
dir<-"asdfasdfasdfasf/asdfasdfs" #change this to your directory
temp <- list.files(pattern="*.csv")
importDM<-lapply(temp, read.csv)
rawDM<-read.csv(importDM, header = TRUE) #will read csv
请让我知道我做错了什么!
干杯,
【问题讨论】:
-
do.call(rbind, lapply(temp, read.csv, header = TRUE))应该可以工作。importDM是一个列表,不是字符串;这就是为什么最后一行给你一个错误。