| extract_match1_conc_search | R Documentation |
pattern_conc_searchuse pattern_conc_search but also extract the match from within the
concatenation. Note to self: the use of pattern_conc_search is
superfluous within this function as it applies searches to the string which
is split at the code.sep, but makes it easier to use search terms
defined as variables
extract_match1_conc_search(
x,
s,
code.sep = " ",
reduce = FALSE,
s.fixed = FALSE
)
x |
(concatenated) search string |
s |
string to match initial part of code |
code.sep |
the string that servers as separator in the concatenation |
reduce |
if |
s.fixed |
set to |
x <- c("ABC", "", "FFF XXX", "GGG ABC FOO",
"BAR ABC", "FOO BAR ABB", " ", ";")
s.term = c("AB(C|B)", "X")
## extract only the (first) matches
extract_match1_conc_search(x, s = s.term, reduce = TRUE)
## extract but do not reduce:
data.frame(x = x,
extr.m1 = extract_match1_conc_search(x, s = s.term,
reduce = FALSE))
## same example, different separator:
y <- gsub(pattern = " ", replacement = ";", x)
data.frame(y = y,
extr = extract_match1_conc_search(y, s = s.term,
code.sep = ";", reduce = FALSE))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.