0

I have a dataset containing values like this:

 list <- c("?stanbul", "Ba?ak?ehir")

What I would like to do now is to replace these values with a space ("").

So therefore I do

list <- gsub("?", "", list)

But this gives me this output:

> list
[1] "?stanbul"   "Ba?ak?ehir"

Any thoughts how I can tackle this?

Frank Gerritsen
  • 185
  • 5
  • 14

1 Answers1

1

Simple as this list <- gsub("\\?", "", list). From the manual of regex:

Any metacharacter with special meaning may be quoted by preceding it with a backslash. The metacharacters in extended regular expressions are . \ | ( ) [ { ^ $ * + ?, but note that whether these have a special meaning depends on the context.

danas.zuokas
  • 4,551
  • 4
  • 29
  • 39