1

How can someone remove this expressions – ( in gsub

Command:

gsub("– (", "", df$Names)

Error:

Error: '\(' is an unrecognized escape in character string starting ""\("
foc
  • 947
  • 1
  • 9
  • 26

1 Answers1

3

You need to escape the parenthesis character ( with a double backslash - one for gsub and one for R:

gsub("– \\(", "", df$Names)
Ben Norris
  • 5,639
  • 2
  • 6
  • 15