These functions change a code into another code, and make it easy to justify that decision.

recode_source(
  input,
  codes,
  output = NULL,
  justification = NULL,
  justificationFile = rock::opts$get("justificationFile"),
  preventOverwriting = rock::opts$get("preventOverwriting"),
  encoding = rock::opts$get("encoding"),
  silent = rock::opts$get("silent")
)

Arguments

input

A file with a source (for recode_source), or a directory with sources (for recode_sources), or an object with one source or multiple sources as produced by one of the loading_sources functions.

codes

A named list of character vectors, where each character vector lists the codes to replace, and the name of that character vector is the code to replace them with.

silent

Whether to be chatty or quiet.

Value

Invisibly, the recoded source(s) or source(s) object.

Examples

### Get path to example source examplePath <- system.file("extdata", package="rock"); ### Get a path to one example file exampleFile <- file.path(examplePath, "example-1.rock"); ### Parse single example source loadedExample <- rock::load_source(exampleFile);