title: Removing characters from string in R
body: <p>I have some tabs or space breaks in my R output (I suspect the problem in the task from which the output comes), making it look like this:</p>
  
  <pre><code>[1841] "\t\t\tGreen\n\t\t"         
  [1842] "Blue"                       
  [1843] "\t\t\tRed\n\t\t" 
  </code></pre>
  
  <p>For a colleague I have to read this into SPSS and that gives some trouble when reading this as txt data, so I wanted to remove the \t and \n parts in my string:</p>
  
  <pre><code>str_replace(mydata, "([\n])", "")
  </code></pre>
  
  <p>Tried it with both \n and \t or combinations, but never quite worked. </p>
  
  <p>Where is my mistake?</p>