read_folder: Read of a folder of files

View source: R/read_functions.R

read_folderR Documentation

Read of a folder of files

Description

read_folder() is a wrapper around lapply to read an entire folder of files into a list. A NULL is returned if the file is unable to be read.

Usage

read_folder(
  folder,
  read_function,
  pattern = NULL,
  .clean_file_names = TRUE,
  .basename = FALSE,
  .id = NULL,
  .recursive = TRUE,
  ...
)

Arguments

folder

A folder path to read.

read_function

The function to use to read each file.

pattern

An optional regex. Only file names which match the regular expression will be read.

.clean_file_names

Logical to clean names into snake_case or not.

.basename

Logical to only keep the basename() of each file.

.id

Character. Optionally add an id variable to each table, named as this value.

.recursive

Logical to recursively load the folder.

...

Arguments passed to read_function.

Value

A list of output from the read_function. A NULL is returned if the file is unable to be read.


Technomics/costmisc documentation built on Nov. 12, 2024, 8:05 a.m.