0

I have a string:

string1 <- "9876442+123456"

and I would like to replace the + sign with a - sign

string2 <- "9876442-123456"

However when I tried:

string2 <-gsub("+", "-", string1)

I got

"-9-8-7-6-4-4-2-+-1-2-3-4-5-6-"

Thank you for your help

adam.888
  • 7,686
  • 17
  • 70
  • 105

0 Answers0