title: R: Specify sprintf string padding character
body: <p>I am trying to create 10-character strings by padding any number with less than 10-characters with zeroes. I've been able to do this with a number of characters less than 10 but the below is causing a 10-character string to form with spaces at the start. How does one make the leading characters 0s?</p>
  
  <pre><code># Current code
  foo &lt;- c("0","999G","0123456789","123456789", "S")
  bar &lt;- sprintf("%10s",foo)
  bar
  
  # Desired:
  c("0000000000","000000999G","0123456789", "0123456789", "00000000S)
  </code></pre>