strs_contains | R Documentation |
strs_contains
checks whether each element of a character vector contains a
specified substring. This function mirrors the functionality of Python's
str.__contains__()
method.
strs_contains(string, substring)
string |
A character vector where each element is a string to be checked. |
substring |
The substring to search for within each element of |
A logical vector of the same length as string
, with each element
indicating whether the corresponding element of string
contains
substring
.
strs_contains("hello world", "world")
strs_contains(c("apple", "banana", "cherry"), "a")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.