read_files: Read Files

Description Usage Arguments Value See Also Examples

View source: R/read.R

Description

Reads multiple files from a directory.

Usage

1
2
read_files(.dir = ".", .pattern = "[.]rds$", .fun = readRDS,
  .recursive = FALSE, .hidden = FALSE, .silent = FALSE, ...)

Arguments

.dir

A string of the path to the directory.

.pattern

A string of the regular expression to use when searching for files. To include all files use ".*".

.fun

The function to use when reading each file. The first argument must be the name of the file.

.recursive

A flag indicating whether to recurse into subdirectories.

.hidden

A flag indicating whether to include hidden files.

.silent

A flag indicating whether error messages should be suppressed when trying to read a file.

...

Additional arguments passed to .fun

Value

A named list of the files.

See Also

list.files

Examples

1
2
3
dir <- system.file("extdata", package = "filer")
objects <- read_files(dir)
lapply(objects, head)

poissonconsulting/filer documentation built on Feb. 17, 2021, 3:26 a.m.