R/stackCSVsfromFolder.R

#' Reads all CSVs from a folder, and stacks them by row
#'
#' Reads all CSVs from a folder (pre-set the working directory), and stacks them by row
#' @param No arguments
#' @keywords stack csv
#' @export
#' @example inst/examples/stackCSVsfromFolder.R

stackCSVsfromFolder <- function() { # make sure wd is set...
  all.files <- list.files(pattern = "\\.csv$") # vector of files in wd ending in csv
  l <- lapply(all.files, data.table::fread) # fread all.files as a list
  x <- data.table::rbindlist(l) # combine by stacking all the rows
  return(x)
}
Braja93/braja documentation built on May 6, 2019, 12:07 a.m.