R/my_csv_reader.R

Defines functions my_csv_reader

Documented in my_csv_reader

#' Reading every csv file in a directory into a list
#'
#' @param dir_path directoy where the csv files are read
#'
#' @return a list of dataframes made up of csv
#' @import assertthat
#' @export
#'
#' @examples
my_csv_reader <- function(dir_path=getwd()){
  assert_that(is.dir(dirname(dir_path)))
  assert_that(is.readable(dirname(dir_path)))

  csvs <- list.files(path=dir_path, pattern="*\\.csv$",full.names = TRUE)
  csv_list <- lapply(csvs, read.csv)
  return(csv_list)
}
Makoto1021/MakotoPackage documentation built on Nov. 18, 2017, 7:51 a.m.