StrPos.Rd
Returns the numeric position of the first occurrence of a substring within a string. If the search string is not found, the result will be NA
.
StrPos(x, pattern, pos = 1, ...)
a character vector in which to search for the pattern, or an object which can be coerced by as.character to a character vector.
character string (search string) containing the pattern to be matched in the given character vector. This can be a character string or a regular expression.
integer, defining the start position for the search within x. The result will then be relative to the begin of the truncated string. Will be recycled.
the dots are passed to the function regexpr
.
This is just a wrapper for the function regexpr
.
a vector of the first position of pattern in x
StrPos(x = levels(d.pizza$driver), pattern = "t")
#> [1] 3 7 4 NA 4 NA NA