Description Usage Arguments Author(s) See Also Examples
View source: R/is-matching-fixed.R
Checks to see if in the input matches a regular expression or fixed character pattern.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | assert_all_are_matching_fixed(x, pattern, opts_fixed = NULL,
na_ignore = FALSE, severity = getOption("assertive.severity", "stop"))
assert_any_are_matching_fixed(x, pattern, opts_fixed = NULL,
na_ignore = FALSE, severity = getOption("assertive.severity", "stop"))
assert_all_are_not_matching_fixed(x, pattern, opts_fixed = NULL,
na_ignore = FALSE, severity = getOption("assertive.severity", "stop"))
assert_any_are_not_matching_fixed(x, pattern, opts_fixed = NULL,
na_ignore = FALSE, severity = getOption("assertive.severity", "stop"))
assert_all_are_matching_regex(x, pattern, opts_regex = NULL,
na_ignore = FALSE, severity = getOption("assertive.severity", "stop"))
assert_any_are_matching_regex(x, pattern, opts_regex = NULL,
na_ignore = FALSE, severity = getOption("assertive.severity", "stop"))
assert_all_are_not_matching_regex(x, pattern, opts_regex = NULL,
na_ignore = FALSE, severity = getOption("assertive.severity", "stop"))
assert_any_are_not_matching_regex(x, pattern, opts_regex = NULL,
na_ignore = FALSE, severity = getOption("assertive.severity", "stop"))
is_matching_fixed(x, pattern, opts_fixed = NULL,
.xname = get_name_in_parent(x))
is_not_matching_fixed(x, pattern, opts_fixed = NULL,
.xname = get_name_in_parent(x))
is_matching_regex(x, pattern, opts_regex = NULL,
.xname = get_name_in_parent(x))
is_not_matching_regex(x, pattern, opts_regex = NULL,
.xname = get_name_in_parent(x))
|
x |
string |
pattern |
pattern |
opts_fixed |
Passed to |
na_ignore |
should NAs be ignored or not? |
severity |
How severe should the consequences of the assertion be?
Either |
opts_regex |
Passed to |
.xname |
Not intended to be used directly. |
Aditya Bhagwat
stri_detect
, on which these functions are
based.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # Is it safe to eat oysters?
is_matching_fixed(month.name, "r")
# Sometimes it is easier to specify the negative match.
is_matching_regex(LETTERS, "[^AEIOU]")
is_not_matching_regex(LETTERS, "[AEIOU]")
# Matching is vectorized over both x and pattern
(pi_digits <- strsplit(format(pi, digits = 17), "")[[1]])
is_matching_regex(pi_digits, c("[13]", "[59]"))
assert_any_are_matching_regex(pi_digits, c("[13]", "[59]"))
# These checks should fail
assertive.base::dont_stop({
assert_all_are_matching_regex(pi_digits, c("[13]", "[59]"))
})
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.