title: Converting decimal to binary in R?
body: <p>What would be the easiest way to convert a number to base 2 (in a string, as for example 5 would be converted to <code>"0000000000000101"</code>) in R? There is <code>intToBits</code>, but it returns a vector of strings rather than a string:</p>
  
  <pre><code>&gt; intToBits(12)
   [1] 00 00 01 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  [26] 00 00 00 00 00 00 00
  </code></pre>
  
  <p>I have tried some other functions, but had no success:</p>
  
  <pre><code>&gt; toString(intToBits(12))
  [1] "00, 00, 01, 01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00"
  </code></pre>