assert_all_are_matching_fixed

0th

Percentile

Does the string match a pattern?

Checks to see if in the input matches a regular expression or fixed character pattern.

Usage
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))
Arguments
x
string
pattern
pattern
opts_fixed
Passed to stri_detect_fixed.
na_ignore
should NAs be ignored or not?
severity
How severe should the consequences of the assertion be? Either "stop", "warning", "message", or "none".
opts_regex
Passed to stri_detect_regex.
.xname
Not intended to be used directly.
See Also

stri_detect, on which these functions are based.

Aliases
  • assert_all_are_matching_fixed
  • assert_all_are_matching_regex
  • assert_all_are_not_matching_fixed
  • assert_all_are_not_matching_regex
  • assert_any_are_matching_fixed
  • assert_any_are_matching_regex
  • assert_any_are_not_matching_fixed
  • assert_any_are_not_matching_regex
  • is_matching_fixed
  • is_matching_regex
  • is_not_matching_fixed
  • is_not_matching_regex
Examples
library(assertive.strings) # 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]")) })
Documentation reproduced from package assertive.strings, version 0.0-3, License: GPL (>= 3)

Community examples

Looks like there are no examples yet.