rg_enframe: Enframe a list of file paths into a tibble

Description Usage Arguments Examples

View source: R/enframe.R

Description

Enframe a list of file paths into a tibble

Usage

1
2
3
4
5
6
7
rg_enframe(
  folder,
  pattern = ".tif$",
  recursive = F,
  sep = "_",
  sep_into = NULL
)

Arguments

folder

string, path to folder where the files are stored

pattern

string, a pattern used to identify the files, see list.files

recursive

logical, should the listing recurse into directories?

sep

string, separator that is used to split up the basename of the files into different columns. If character, sep is interpreted as a regular expression. The default value is a regular expression that matches any sequence of non-alphanumeric values. If numeric, sep is interpreted as character positions to split at. Positive values start at 1 at the far-left of the string; negative value start at -1 at the far-right of the string. The length of sep should be one less than sep_into. see separate

sep_into

string, names of new variables to create as character vector. Use NA to omit the variable in the output.

Examples

1
2
folder <- 'data/files'
df <- rg_enframe(folder, pattern = '.csv$', sep = '_', sep_into = c(NA, 'year', 'type'))

sitscholl/Rgadgets documentation built on Feb. 19, 2021, 1:24 a.m.