I have several .csv files with these names (from 1 January 2016 to 31 december 2016)
01012016.csv
02012016.csv
...
31122016.csv
I want to use read.csv(
by using a loop but still considering date patterns.
start<-as.Date("01-01-16")
end<-as.Date("31-12-16")
theDate<-start
{read.csv(theDate,".csv")}
You can get the names of all the files using
list.files
and giving it the path of all folder where all the files are located:Then you can use
lapply
to iterate over the vector 'filenamescontaining the names of files and apply
read.csvto each of them and set additional parameters like
headerand
stringsAsFactors` as TRUE or FALSE as required: