title: Count the number of words without white spaces
body: <p>I have the following string:</p>
  
  <pre><code>str1&lt;-" india hit milestone electricity wind solar"
  </code></pre>
  
  <p>Number of words contained in it is:</p>
  
  <pre><code>&gt;sapply(strsplit(str1, " "), length)
  [1] 7
  </code></pre>
  
  <p>It is not true because we have a space at the beginning of <code>str1</code>. I tried to trim the white space but:</p>
  
  <pre><code>&gt; stripWhitespace(str1) # by tm package
  </code></pre>
  
  <p>returns the same situation:</p>
  
  <pre><code>[1] " india hit milestone electricity wind solar"
  </code></pre>
  
  <p>Why?</p>