sinkDirectory: Import All .rds Files in a Directory.

View source: R/sinkDirectory.R

sinkDirectoryR Documentation

Import All .rds Files in a Directory.

Description

Import all .rds files in a directory.

Usage

sinkDirectory(
  path,
  string.keep = NULL,
  string.exclude = NULL,
  addMissingCol = FALSE,
  fixed = FALSE,
  trace = TRUE
)

Arguments

path

[character] path to the directory.

string.keep

[regexp] character string indicating files to import.

string.exclude

[regexp] character string indicating files to ignore.

addMissingCol

[logical] if a dataset does not have the same columns as the other, the necessary empty columns are added to it with NA as values.

fixed

[logical] If TRUE, pattern is a string to be matched as is. Argument passed to grep.

trace

[logical] should a progress bar be displayed tracking how many files have been imported.

Details

The function first read the name of all the files in the directory. Then if the argument string.keep is not NULL, it only retains the files whose name contain string.keep. Then if the argument string.exclude is not NULL, it excludes the files whose name contain string.exclude.

Each file must contain a data.table object with the same columns, so that they can be combined.

Value

A data.table object.

Author(s)

Brice Ozenne


bozenne/butils documentation built on Oct. 14, 2023, 6:19 a.m.