By the way, the reason str_squish() didn’t work is that it’s solving a slightly different problem. It only removes repeated internal whitespace, so it will turn 2+ spaces into 1, but not 1 space into 0. For example (shamelessly lifted from the documentation):
str_squish(" String with trailing, middle, and leading white space\t")
#> [1] "String with trailing, middle, and leading white space"