files2list: Load Multiple Data Files into one List

files2listR Documentation

Load Multiple Data Files into one List

Description

These functions load multiple data files from a specified directory and save them into one list.

  • rda2list() loads multiple .rda files

  • dat2list() loads multiple .dat files

  • csv2list() loads multiple .csv files

Usage

rda2list(.path = ".", .file_pattern = ".rda$", .recursive = FALSE)

dat2list(
  .path = ".",
  .file_pattern = ".dat$",
  .recursive = FALSE,
  .sep = ";",
  .dec = ".",
  .header = TRUE
)

csv2list(
  .path = ".",
  .file_pattern = ".csv$",
  .recursive = FALSE,
  .sep = ";",
  .dec = ".",
  .header = TRUE
)

Arguments

.path

A string indicating the path of the directory that contains the files to be loaded. The default is the current working directory.

.file_pattern

A regular expression to return the files that this regular expression matches.

  • For rda2list() the default is to load all files ending with ".rda"

  • For dat2list() the default is to load all files ending with ".dat"

  • For csv2list() the default is to load all files ending with ".csv"

.recursive

A logical indicating whether to recurse into directories. The default is FALSE.

.sep

The field separator character. The default is a semicolon.

.dec

The decimal point character used in the files. The default is a point.

.header

A logical indicating whether the files have a column header.

Value

A list that contains the files in .path matching the expression specified in .file_pattern.

See Also

See also utils::read.table().

Examples

# load all .rda files in the current working directory into one list
rda2list()
# load all .dat files in the current working directory into one list
dat2list()
# load all .csv files in the current working directory into one list
csv2list()


sophiestallasch/multides documentation built on Oct. 20, 2024, 5:14 a.m.