string_replacements {DIZtools} | R Documentation |
Clean string with a given set of replacements.
Description
This function provides the functionality to clean a string with a given set of replacements. This is e.g. useful to create filenames or paths that are not allowed to contain spaces.
Usage
string_replacements(
input,
replace_mapping = "default",
tolower = FALSE,
toupper = FALSE
)
Arguments
input |
(string) The character string to be processed. |
replace_mapping |
(Optional, list, default = "default") The mapping containing what should be replaced with what: 'replace_mapping <- list("replace_this" = "with_this")' |
tolower |
(boolean, default = FALSE) Should the result be lowercase? |
toupper |
(boolean, default = FALSE) Should the result be uppercase? |
Value
(String) All elements (names) of the input 'replace_mapping' or the default mapping are replaced by its values of the mapping.
Examples
string_replacements(input = "Ab 20. April 2020 (((___((N = 1.234)")
# Result: "Ab_20_April_2020_N_1234"
[Package DIZtools version 1.0.1 Index]