strExtract | R Documentation |
Uses regexpr()
internally without regmatches()
.
strExtract(x, pattern, fixed = FALSE)
x |
|
pattern |
|
fixed |
|
Expands with NA
values for match failures, like stringi and stringr.
character
.
Character vector of matches. Failures return NA
.
Updated 2023-09-25.
regexpr()
, regmatches()
.
stringi::stri_extract_first()
.
stringr::str_extract()
.
https://stringr.tidyverse.org/articles/from-base.html
object <- strExtract(
x = c("apples x10", "bag of flour", "bag of sugar", "milk x200", NA),
pattern = "\\d+"
)
print(object)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.