str_detect2 | R Documentation |
A wrapper for stringr's str_detect
so that one can get the matches values, not just logical values. This restores the functionality of base-r's equivalent function, gsub
.
str_detect2(string, pattern, value = F)
string |
(character vector) A character vector. |
pattern |
(character vector) Pattern to look for (REGEX). |
value |
(log scalar) Whether to return the matched values instead of logical values. Default = F. |
A character vector. Note that it will have a length longer than one if one of the inputs has that.
str_detect2(letters[1:10], pattern = "[acbde]")
str_detect2(letters[1:10], pattern = "[acbde]", value = T)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.