Last chance! 50% off unlimited learning
Sale ends in
string
and pattern
, shorter
is recycled to same length as longest.str_locate_all(string, pattern)
$
) end will be one character less than start.regexpr
which this function wraps str_extract
for a convenient way of
extracting matches
str_locate
to locate position of first
match
fruit <- c("apple", "banana", "pear", "pineapple")
str_locate_all(fruit, "a")
str_locate_all(fruit, "e")
str_locate_all(fruit, c("a", "b", "p", "p"))
Run the code above in your browser using DataLab