Standardises words in a character title variable to improve readability, facilitate string matching and enable more accurate comparisons for variables in different datatsets.

standardise_titles(s)

standardize_titles(s)

Arguments

s

A string

Value

A capitalised, trimmed and standardised string

Details

The function capitalises words in the strings passed to it. It trims white spaces from the start, middle and end of the strings. Removes ambiguous punctions and symbols from strings. All the strings are transformed into to ASCII character encoding. Written numbers in ordinal form are transformed into numerical form.

Examples

e <- standardise_titles("A treaty concerning things")
e==c("A Treaty Concerning Things")
#> [1] TRUE