Function cleans up the text string improving narration, removing excessive white spaces
Arguments
- text
Text string for cleaning. Can contain multiple sentences.
- upper
Vector of words that need to be changed to uppercase in text
- lower
Vector of words that need to be changed to lowercase in text
Examples
text <- "Similarly in 2020 the sum of spend increased by 15.4% ( 4.3 % higher than average)."
clean_text(text)
#> [1] "Similarly in 2020 the sum of spend increased by 15.4 % (4.3 % higher than average)."
clean_text(" Total is 12,300 Orders ( 23.5 % for East ) ")
#> [1] "Total is 12,300 Orders (23.5 % for East )"