extract_yaml_dir {yum}R Documentation

Extract all YAML fragments from all files in a directory

Description

These function extracts all YAML fragments from all files in a directory returning a list of character vectors containing the extracted fragments.

Usage

extract_yaml_dir(
  path,
  recursive = TRUE,
  fileRegexes = c("^[^\\.]+.*$"),
  delimiterRegEx = "^---$",
  ignoreOddDelimiters = FALSE,
  encoding = "UTF-8",
  silent = TRUE
)

Arguments

path

The path containing the files.

recursive

Whether to also process subdirectories (TRUE) or not (FALSE).

fileRegexes

A vector of regular expressions to match the files against: only files matching one or more regular expressions in this vector are processed. The default regex (⁠^[^\.]+.*$⁠) matches all files except those that start with a period (.).

delimiterRegEx

The regular expression used to locate YAML fragments.

ignoreOddDelimiters

Whether to throw an error (FALSE) or delete the last delimiter (TRUE) if an odd number of delimiters is encountered.

encoding

The encoding to use when calling readLines(). Set to NULL to let readLines() guess.

silent

Whether to be silent (TRUE) or informative (FALSE).

Value

A list of character vectors.

Examples

### First get the directory where 'yum' is installed
yumDir <- system.file(package="yum");
### Specify the path of some example files
examplePath <- file.path(yumDir, "extdata");
### Show files (should be three .dct files)
list.files(examplePath);
### Load these files
yum::extract_yaml_dir(path=examplePath);

[Package yum version 0.1.0 Index]