string_std | R Documentation |
Standardizes strings prior to performing a match, using the following transformations:
standardize case (base::tolower
)
remove sequences of non-alphanumeric characters at start or end of string
replace remaining sequences of non-alphanumeric characters with "_"
remove diacritics (stringi::stri_trans_general
)
(optional) convert roman numerals (I, II, ..., XLIX) to arabic (1, 2, ..., 49)
string_std(x, convert_roman = FALSE)
x |
a string |
convert_roman |
logical indiciating whether to convert roman numerals (I, II, ..., XLIX) to arabic (1, 2, ..., 49) |
The standardized version of x
string_standardization
string_std("United STATES")
string_std("R\u00e9publique d\u00e9mocratique du Congo")
# convert roman numerals to arabic
string_std("Mungindu-II (Sud)")
string_std("Mungindu-II (Sud)", convert_roman = TRUE)
# note the conversion only works if the numeral is separated from other
# alphanumeric characters by punctuation or space characters
string_std("MunginduII", convert_roman = TRUE) # roman numeral not recognized
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.