This function shortens strings that are longer than
chars, without cropping words.
shorten_string(s, max.length = NULL, abbr = "...")
Maximum length of chars for the string.
String that will be used as suffix, if
s was shortened.
A shortened string.
If the string length defined in
max.length happens to be inside
a word, this word is removed from the returned string (see 'Examples'), so
the returned string has a maximum length of
might be shorter.
s <- "This can be considered as very long string!" # string is shorter than max.length, so returned as is shorten_string(s, 60) #>  "This can be considered as very long string!" # string is shortened to as many words that result in # a string of maximum 20 chars shorten_string(s, 20) #>  "This can be..." # string including "considered" is exactly of length 22 chars shorten_string(s, 22) #>  "This can be considered..."