read_batch: Utility for dataset batch importing in multiple formats

View source: R/read_batch.R

read_batchR Documentation

Utility for dataset batch importing in multiple formats

Description

Reference: https://www.gerkelab.com/blog/2018/09/import-directory-csv-purrr-readr/#'

Usage

read_batch(data_dir, ext = "csv", fun = readr::read_csv, env = TRUE, ...)

Arguments

data_dir

data_dir is the file path that contains the files that will be imported

ext

extension "*.ext" of the files that will be imported. Default "csv"

fun

the import function that will be passsed to 'map' to import datasets. Must be able to read files with the 'ext' extension

env

Whether the file will be imported to .GlobalEnv. If 'FALSE' a list containing all the dataset will be generated

...

Arguments passed to the import function

Import multiple files

Examples

## Not run: 
read_batch(data_dir = data_dir)
read_batch(data_dir = data_dir, extension = "dta", fun = haven::read_dta)
read_batch(data_dir = data_dir, extension = "dta", fun = haven::read_dta, env = F)

## End(Not run)

healthinnovation/lis documentation built on June 19, 2024, 6:06 a.m.