match_consecutive_delimiters {rock} | R Documentation |
Match the corresponding indices of (YAML) delimiters in a sequential list
Description
This is just a convenience function that takes a vector of deliminaters and returns a list of delimiter pairs.
Usage
match_consecutive_delimiters(
x,
errorOnInvalidX = FALSE,
errorOnOdd = FALSE,
onOddIgnoreFirst = FALSE
)
Arguments
x |
The vector with delimiter indices |
errorOnInvalidX |
Whether to return |
errorOnOdd |
Whether to throw an error if the number of delimiter indices is odd. |
onOddIgnoreFirst |
If the number of delimiter indices is odd and no
error is thrown, whether to ignore the first ( |
Value
A list where each element is a two-element vector with the two consecutive delimiters
Examples
rock::match_consecutive_delimiters(
c(1, 3, 5, 10, 19, 25, 30, 70)
);
exampleText <- c(
"some text",
"delimiter",
"more text",
"delimiter",
"filler text",
"intentionally left blank",
"delimiter",
"final text",
"delimiter"
);
rock::match_consecutive_delimiters(
grep(
"delimiter",
exampleText
)
);
[Package rock version 0.8.1 Index]