Description Usage Arguments Value Examples
View source: R/internal-string.R
Removes invalid characters from a string, leaving only digits.
1 2 3 4 5 | strip_invalid_chars(x, invalid_chars, char_desc = gettext("invalid"))
strip_non_alphanumeric(x)
strip_non_numeric(x, allow_x = FALSE, allow_plus = FALSE)
|
x |
Input to strip. |
invalid_chars |
A regular expression detailing characters to remove. |
char_desc |
A string describing the characters to remove. |
allow_x |
If |
allow_plus |
If |
A character vector of the same length as x
, consisting of
strings without the characters detailed in the invalid_chars
.
1 2 3 4 5 6 7 8 9 | ## Not run:
strip_invalid_chars(
" We're floating\tin space\n\n\n", "[[:space:]]", "whitespace"
)
strip_non_numeric(" +44 800-123-456 ", allow_plus = TRUE)
#Inputs such as factors as coerced to character.
strip_non_alphanumeric(factor(c(" A1\t1AA.", "*(B2^2BB)%")))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.