I have a folder with many txt. files and want to import them in one dataframe. I noticed that after 700-800 files, the loop starts working very slow. Is there is a way to optimize the loop or a function that gives the same output faster?
DF<-data.frame()
for (i in 1:20000){
newDF<-t
newDF<- tryCatch(read.table(paste0("PATH",i,".txt"), header=FALSE, sep = ","), error=function(e) NULL)
DF<-rbind(DF,newDF)
}