title: How to format to a string to a fixed length which stores in a variable?
body: <p>I have a number and I want to format to a string with zero padding and a specific length . Suppose if the fixed length is 22 , I know I can do in this way</p>
  
  <pre><code> format(variable,"%022d")
  </code></pre>
  
  <p>but does there exist any way can do by this </p>
  
  <pre><code>length = 22
  format(variable,"%0lengthd")
  </code></pre>
  
  <p>It means I need to use variable in <code>% variable d</code> expression</p>
  
  <p>thanks</p>