title: adding or retaining leading zeros without converting to character format
body: <p>Is it possible to add or retain one or more leading zeros to a number without the result being converted to character?  Every solution I have found for adding leading zeros returns a character string, including: <code>paste</code>, <code>formatC</code>, <code>format</code>, and <code>sprintf</code>.</p>
  
  <p>For example, can <code>x</code> be <code>0123</code> or <code>00123</code>, etc., instead of <code>123</code> and still be numeric?</p>
  
  <pre><code>x &lt;- 0123
  </code></pre>
  
  <p>EDIT</p>
  
  <p>It is not essential.  I was just playing around with the following code and the last two lines gave the wrong answer.  I just thought maybe if I could have leading zeros with numeric format obtaining the correct answer would be easier.</p>
  
  <pre><code>a7   = c(1,1,1,0); b7=c(0,1,1,1);  # 4
  a77  = '1110'    ; b77='0111'   ;  # 4
  a777 =  1110     ; b777=0111    ;  # 4
  
  length(b7[(b7 %in% intersect(a7,b7))])
  </code></pre>
  
  <p><a href="https://stackoverflow.com/questions/14928326/r-count-matches-between-characters-of-one-string-and-another-no-replacement">R - count matches between characters of one string and another, no replacement</a></p>
  
  <pre><code>keyword &lt;- unlist(strsplit(a77, ''))
  text    &lt;- unlist(strsplit(b77, ''))
  sum(!is.na(pmatch(keyword, text)))
  
  ab7 &lt;- read.fwf(file = textConnection(as.character(rbind(a777, b777))), widths = c(1,1,1,1), colClasses = rep("character", 2))
  length(ab7[2,][(ab7[2,] %in% intersect(ab7[1,],ab7[2,]))])
  </code></pre>