vgrabovets
11/29/2016 - 8:24 AM

readFiles

readFiles

readFiles = function(path, col.names, header = FALSE, sep = ",", stringsAsFactors = FALSE){
     files_list = list.files(path, full.names = TRUE)
     report_h <- data.frame(matrix(ncol = length(col.names), nrow = 0))
     names(report_h) = col.names
     k = 0
     for (i in files_list){
          files = read.csv(i, sep = ",", header = header, stringsAsFactors = stringsAsFactors)
          names(files) = col.names
          report_h = dplyr::bind_rows(report_h, files)
          k = k + 1
          print(paste(i, round(k/length(files_list),2), sep = " --> "))
     }
     return(report_h)
}