title: How to split a list or a vector in r?
body: <p>In developing of Sentiment Analysis application using R, I need to split result of the matched words, </p>
  
  <p><strong>First</strong> (done)</p>
  
  <pre><code>pos.matches = match(words, pos.words)
  </code></pre>
  
  <p><strong>Second</strong> (done)</p>
  
  <pre><code>words_matched=words[pos.matches]
  </code></pre>
  
  <p>From the secondary step, let's take an example that the method will return </p>
  
  <pre><code>happy happy sad
  </code></pre>
  
  <p>My question is, how to split the result from secondary step into like this:</p>
  
  <pre><code>[1] happy
  
  [2] happy 
  
  [3] sad
  </code></pre>
  
  <p>Right now I'm using strsplit function</p>
  
  <pre><code> strsplit((words[pos.matches])," ")  
  </code></pre>
  
  <p>but it is notifying me that there's an error </p>
  
  <blockquote>
    <p>Warning: Error in cat: argument 1 (type 'list') cannot be handled by
    'cat'</p>
  </blockquote>