read.delim中用于lapply的参数

时间:2014-09-21 11:02:09

标签: r csv import lapply

我正在使用以下代码来读取一组CSV文件:

csvfiles = list.files(pattern = "*.csv", path = "./Data/", 
                      full.names = TRUE)
## Merge into one object
myfiles = lapply(csvfiles, read.delim)

我想将一些参数传递给read.delim函数,以便跳过一组初始行,定义分隔符等,但每当我尝试这样做时,R都会返回一个错误,如下所示:

> myfiles = lapply(csvfiles, read.delim(skip = 2))
Error in read.table(file = file, header = header, sep = sep, quote = quote,  : 
  argument "file" is missing, with no default

如上所示,与 lapply 一起使用时,修改 read.delim 函数参数的正确语法是什么?

0 个答案:

没有答案