I would like to reduce all spaces longer than a single space in a string to a single space.
foo(" 1 2 3 4 5 ")
[1] " 1 2 3 4 5 "
I would like to reduce all spaces longer than a single space in a string to a single space.
foo(" 1 2 3 4 5 ")
[1] " 1 2 3 4 5 "
That would work:
gsub(' +',' ',foo)
:)
(edited to take into account Zach's comment)