delete_yaml_fragments: Delete all YAML fragments from a file

Description Usage Arguments Value Examples

View source: R/delete_yaml_fragments.R

Description

These function deletes all YAML fragments from a file, returning a character vector without the lines that specified the YAML fragments.

Usage

1
2
3
4
5
6
7
delete_yaml_fragments(
  file,
  text,
  delimiterRegEx = "^---$",
  ignoreOddDelimiters = FALSE,
  silent = TRUE
)

Arguments

file

The path to a file to scan; if provided, takes precedence over text.

text

A character vector to scan, where every element should represent one line in the file; can be specified instead of file.

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.

silent

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

Value

A list of character vectors.

Examples

1
2
3
4
yum::delete_yaml_fragments(text=c("---", "First YAML fragment", "---",
                                   "Outside of YAML",
                                   "---", "Second fragment", "---",
                                   "Also outside of YAML"));

yum documentation built on July 17, 2021, 1:07 a.m.