%contains_word% | R Documentation |
Looks for a string appearing on its own. This is needed e.g.
when checking whether the replies to a mmc item, stored as a
comma-separated list from 1 to 12 contain option 1 - you wouldn't
want to get a hit for 11 and 12.
Only works for search terms containing alphanumeric characters.
Just a simple shorthand so that inexperienced R users don't have
to use somewhat complex functions such as grepl()
and stringr::str_detect()
.
haystack %contains_word% needle
haystack |
string in which you search |
needle |
string to search for |
"1, 3, 4" %contains_word% "1" # TRUE
"1, 3, 4" %contains_word% 1 # TRUE unlike str_detect casts all needles as characters
"12, 14, 17" %contains_word% "1" # FALSE even though 12 contains 1
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.