prepend_ids_to_source {rock} | R Documentation |
Prepending unique utterance identifiers
Description
This function prepends unique utterance identifiers to each
utterance (line) in a source. Note that you'll probably want
to clean the sources using clean_sources()
first.
Usage
prepend_ids_to_source(
input,
output = NULL,
origin = Sys.time(),
rlWarn = rock::opts$get(rlWarn),
preventOverwriting = rock::opts$get(preventOverwriting),
encoding = rock::opts$get(encoding),
silent = rock::opts$get(silent)
)
prepend_ids_to_sources(
input,
output = NULL,
outputPrefix = "",
outputSuffix = "_withUIDs",
origin = Sys.time(),
preventOverwriting = rock::opts$get(preventOverwriting),
encoding = rock::opts$get(encoding),
silent = rock::opts$get(silent)
)
Arguments
input |
The filename or contents of the source
for |
output |
The filename where to write the resulting file for
|
origin |
The time to use for the first identifier. |
rlWarn |
Whether to let |
preventOverwriting |
Whether to overwrite existing files ( |
encoding |
The encoding of the file(s). |
silent |
Whether to be chatty or quiet. |
outputPrefix , outputSuffix |
The prefix and suffix to add to the filenames when writing the processed files to disk. |
Value
The source with prepended uids, either invisible (if output
if specified) or visibly (if not).
Examples
### Simple example
rock::prepend_ids_to_source(
"brief\nexample\nsource"
);
### Example including fake YAML fragments
longerExampleText <-
c(
"---",
"First YAML fragment",
"---",
"So this is an utterance (i.e. outside of YAML)",
"This, too.",
"---",
"Second fragment",
"---",
"Another real utterance outside of YAML",
"Another one outside",
"Last 'real utterance'"
);
rock::prepend_ids_to_source(
longerExampleText
);