title: Count occurrences of specific words from a dataframe row in R
body: <p>I have a Dataset with 2 columns and multiple rows. 
  first column ID, second column the text which belongs to it.</p>
  
  <p>I want to add more columns which sums up how many times a certain string appears in the text from the Row. the string would be "\n  Positive\n", "\n  Neutral\n", "\n  Negativ\n"`</p>
  
  <p>Example of the Dataset:</p>
  
  <pre><code>Id, Content
  2356, I like cheese.\n  Positive\nI don't want to be here.\n Negative\n
  3456, I am alone.\n Neutral\n
  </code></pre>
  
  <p>At the End it should look like</p>
  
  <pre><code>Id, Content,Positiv, Neutral, Negativ
  2356, I like cheese.\n  Positive\nI don't want to be here.\n Negative\n,1 ,0 ,1
  3456, I am alone.\n Neutral\n, 0, 1, 0
  </code></pre>
  
  <p>Right now i tried it like this but it isn't giving the right answers:</p>
  
  <pre><code>getCount1 &lt;- function(data, keyword)
  {
  Positive &lt;- str_count(Dataset$CONTENT, keyword)
  return(data.frame(data,Positive))
  }
  Stufe1 &lt;-getCount1(Dataset,'\n Positive\n')
  ################################################################
  getCount2 &lt;- function(data,  keyword)
  {
  Neutral &lt;- str_count(Stufe1$CONTENT, keyword)
  return(data.frame(data,Neutral))
  }
  Stufe2 &lt;-getCount2(Stufe1,'\n  Neutral\n')
  #####################################################
  getCount3 &lt;- function(data,  keyword)
  {
  Negative &lt;- str_count(Stufe2$CONTENT, keyword)
  return(data.frame(data,Negative))
  }
  Stufe3 &lt;-getCount3(Stufe2,'\n  Negative\n')
  </code></pre>