Description Usage Arguments Details Examples
It's often useful in doing partial string comparisons (eg, for comparing street addresses) to remove non-standard characters and reduce the length.
1 2 | tidy_string(string, length = -1, pattern = "[^A-Za-z0-9]",
lowercase = TRUE)
|
string |
character vector of strings to truncate |
length |
how long (at most) the resulting strings should be. -1 (default) to not truncate. |
pattern |
regex pattern for characters that should be removed. |
By default, only alpha-numeric characters are retained
1 2 3 | address1 <- "123 N Washington way"
address2 <- "123 N. Washington"
identical(str_truncate(address1, 8), str_truncate(address2, 8))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.