Description Usage Arguments Value Note References Examples
Checks that the input contains email addresses. (It does not check the the address exists, merely that the string is in a suitable format.)
1 2 3 4 5 6 7 8 9 | assert_all_are_email_addresses(x, method = c("simple", "rfc5322"),
na_ignore = FALSE, severity = getOption("assertive.severity",
"stop"))
assert_any_are_email_addresses(x, method = c("simple", "rfc5322"),
na_ignore = FALSE, severity = getOption("assertive.severity",
"stop"))
is_email_address(x, method = c("simple", "rfc5322"))
|
x |
Input to check. |
method |
Name of method to check for validity. See notes below. |
na_ignore |
A logical value. If |
severity |
How severe should the consequences of the assertion be?
Either |
A logical vector that is TRUE
when the input contains valid
email addresses.
Each method specifies a regular expression (see
regex
) to match against. The simple
method matches
most email addresses in use, and is quite good at filtering out typos and
nonsense. It won't match every email address however. For example,
emails from a top level domain longer than 4 characters won't pass. The
rfc5322
method implements the official standard for emails. Thus all
genuine emails will pass, but since the spec is very broad, it isn't as good
at filtering out nonsense.
http://www.regular-expressions.info/email.html contains the regexes used by this function and a good discussion of the pros and cons of each.
1 2 3 4 5 6 7 8 9 10 | addresses <- c(
ok = "a@b.com",
no_at = "a_at_b.com",
no_dot = "a@bcom",
long_tld = "a@b.comma",
punct = "a!$&@b.com",
missing = NA
)
is_email_address(addresses)
is_email_address(addresses, method = "rfc5322")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.