Commit 8d3792a0 authored by Quentin Read's avatar Quentin Read
Browse files

fn to read all csvs in a dir

parent 3088d486
......@@ -2,6 +2,7 @@
export(group_nest_dt)
export(read.csv.better)
export(read_all_csvs)
export(replace_na_dt)
export(unnest_dt)
import(data.table)
#' Read all CSVs in a directory
#'
#' The resulting R objects will have the same name as the CSVs,
#' with the .csv suffix removed. Uses fread()
#'
#' @export
read_all_csvs <- function(dir_path) {
require(purrr)
walk(dir(dir_path, pattern = '*.csv'), ~ assign(gsub('.csv', '', .), fread(file.path(dir_path, .)), envir = .GlobalEnv))
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/read_all_csvs.R
\name{read_all_csvs}
\alias{read_all_csvs}
\title{Read all CSVs in a directory}
\usage{
read_all_csvs(dir_path)
}
\description{
The resulting R objects will have the same name as the CSVs,
with the .csv suffix removed. Uses fread()
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment