title: How to remove leading white space
body: <p>I'm not familiar with text processing in R and am stuck on how to remove a leading white space in a string.  Here is some code:</p>
  
  <pre><code>set.seed(1234)
  b &lt;- paste0(sample(c("bbb ", " bbb "), 10, replace = TRUE), rep("ccc ddd", 10))
  print(b)
  
   [1] "bbb ccc ddd"  " bbb ccc ddd" " bbb ccc ddd" " bbb ccc ddd" " bbb ccc ddd"
   [6] " bbb ccc ddd" "bbb ccc ddd"  "bbb ccc ddd"  " bbb ccc ddd" " bbb ccc ddd"
  </code></pre>
  
  <p>I figured out that I can remove trailing white spaces <code>sub(' +$', '', b)</code> but changing it to sub<code>('$+ ', '', b)</code> doesn't remove the leading white space.  Guessing it is a quick fix...</p>