Displaying 1 result from an estimated 1 matches for "plustpluswplusoplus".
2012 Jan 21
2
replacing "+" in string
I am trying to replace "+" in a string with another character
I am getting odd results using sub and gsub
> X<-"one + two"
> gsub("+","plus",X)
[1] "plusoplusnpluseplus plus+plus plustpluswplusoplus"
> sub("+","plus",X)
[1] "plusone + two"
> X<-"one ~ two"
it seems to work fine with other characters:
> sub("~","plus",X)
[1] "one plus two"
How do I enable "+" to be recognised as a normal charact...