Reputation: 179
I found some information on how to load multiple files csv files into R. I am trying modify their code to work with files that are tab separated. This is the code that
#list of files
files <- list.files(currentFilePath)
for(filename in files){
print(filename)
}
allFiles.list <- lapply(files, read.csv)
This code works but treats does not recognize that the data is tab separated. I have seen examples on using read.table however, this is with a single file. I don't see how I can do it using the lapply approach above with multiple files.
Upvotes: 2
Views: 1489
Reputation: 678
You can add arguments to FUN
using the ...
argument of lapply
, e.g.
allFiles.list <- lapply(files, read.table, sep = '\t')
Upvotes: 2