Description Usage Arguments Value Examples
This function behaves similarly to betterGrepl, except that it returns only one logical value
1 | betterGrepl.any(pattern, x, ignore.case = T, fixed = T)
|
pattern |
character string containing a regular expression (or character string for fixed = TRUE) to be matched in the given character vector. Coerced by as.character to a character string if possible. If a character vector of length 2 or more is supplied, the first element is used with a warning. |
x |
a character vector where matches are sought, or an object which can be coerced by as.character to a character vector. Long vectors are supported. |
ignore.case |
logical. if FALSE, the pattern matching is case sensitive and if TRUE, case is ignored during matching. |
fixed |
logical. If TRUE, pattern is a string to be matched as is. Overrides all conflicting arguments. |
Logical vector indicating whether any elements had matches
1 2 3 4 5 6 7 8 9 | x = c("Alpha", "Beta", "Bet", NA_character_, "B")
betterGrepl.any(pattern = "a", x)
betterGrepl.any(pattern = NA, x)
betterGrepl.any(pattern = NA, x, ignore.case = F)
betterGrepl.any("Beta", x)
betterGrepl.any("beta", x)
betterGrepl.any("beta", x, ignore.case = F)
betterGrepl.any("B", x)
betterGrepl.any("X", x)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.