如何删除逗号后出现的空格

时间:2015-02-01 22:26:02

标签: regex r string trim

我有一个看起来像这样的载体

vector = c('hello, how are you, I am good', 
           'the sky is blue, isnt that nice')

我想删除每个内容中的空格。 '以逗号后来的

即。输出应该如下:

'hello,how are you,I am good','the sky is blue,isnt that nice'

1 个答案:

答案 0 :(得分:2)

要关闭此问题:

gsub(", +", ",", vector)