[R] Suppress blanks/spaces in character

thsudler at swissonline.ch thsudler at swissonline.ch
Fri Oct 27 18:24:02 CEST 2006


Hi all

I'm have a character vector and would like to suppress the blanks if there are more than one after the other.

Example:

Character value is: "abc     def  ghi"
The result should be: "abc def ghi"

I know that it's possible to delete the leading blanks with the command "trim". But how can I delete blanks within a character?

Thank you very much in advance for an answer
Thomas



More information about the R-help mailing list