0

How can someone remove this expressions – ( in gsub

Command:

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

Error:

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

1 Answers1

2

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

gsub("– \\(", "", df$Names)
Ben Norris
  • 5,226
  • 2
  • 7
  • 14