title: How to remove specific special characters in R
body: <p>I have some sentences like this one.</p>
  
  <pre><code>c = "In Acid-base reaction (page[4]), why does it create water and not H+?" 
  </code></pre>
  
  <p>I want to remove all special characters except for '?&amp;+-/</p>
  
  <p>I know that if I want to remove all special characters, I can simply use</p>
  
  <pre><code>gsub("[[:punct:]]", "", c)
  "In Acidbase reaction page4 why does it create water and not H"
  </code></pre>
  
  <p>However, some special characters such as + - ? are also removed, which I intend to keep. </p>
  
  <p>I tried to create a string of special characters that I can use in some code like this</p>
  
  <pre><code>gsub("[special_string]", "", c)
  </code></pre>
  
  <p>The best I can do is to come up with this </p>
  
  <pre><code>cat("!\"#$%()*,.:;&lt;=&gt;@[\\]^_`{|}~.")
  </code></pre>
  
  <p>However, the following code just won't work</p>
  
  <pre><code>gsub("[cat("!\"#$%()*,.:;&lt;=&gt;@[\\]^_`{|}~.")]", "", c)
  </code></pre>
  
  <p>What should I do to remove special characters, except for a few that I want to keep?</p>
  
  <p>Thanks</p>