char_replace | R Documentation |
This function replaces non-standard characters (such as the German Umlaut 'ä') with their standard equivalents (in this case 'ae'). Arguments enable the user to force all characters to lower-case, trim leading and trailing whitespace characters or replace all whitespace characters and dashes with underscores or remove all whitespace characters within the string.
char_replace(
x,
to_lower = FALSE,
trim = TRUE,
rm_space = FALSE,
rm_dash = FALSE,
to_underscore = FALSE
)
x |
character vector, contains special characters needing to be replaced. |
to_lower |
logical, forces all characters to lower-case |
trim |
logical, if whitespaces are trimmed from the start and end. Is
ignored with |
rm_space |
logical, removes all whitespace characters within the string. |
rm_dash |
logical, removes all dash-characters within the string. |
to_underscore |
logical, replaces all whitespace and dash-characters with underscores. |
a character vector with all non-standard characters replaced by their standard counterparts
Oliver Guggenbuehl
x <- "Élizàldë-González Strasse"
char_replace(x)
char_replace
char_replace(x, to_lower = TRUE, to_underscore = TRUE)
char_replace(x, to_lower = TRUE, rm_space = TRUE, rm_dash = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.