Reputation: 5719
I want to select all the files(all.files
) in three different folders and use a function on those files. So when I use a function or loop to loop over each of all.files
, I should be able to get access to those files in their respective directories.How do I achieve this goal?
I did something like this, but did not work:
bam.dir <- c("path1/ABAM/","path2/BBAM/","path3/CBAM/")
all.files<-list.files(bam.dir)
Upvotes: 1
Views: 51
Reputation: 32446
Try
all.files <- Vectorize(list.files)(bam.dir)
This creates a vectorized version of list.files
, allowing you to pass a vector of directories as the first argument.
Upvotes: 1