title: how to use _sprintf_ and _for_ in R programming
body: <p>I'm a beginner in R programming. I'm trying to use a <em>for</em> loop with the <em>sprintf</em> function. Without the for loop the function works pretty well:</p>
  
  <pre><code>var=2
  sprintf("I want to print this number: %d",var)
  </code></pre>
  
  <p>The output:</p>
  
  <pre><code>"I want to print this number: 2"
  </code></pre>
  
  <p>Oddly for me, when I use <em>for</em> I don't have any outputs:</p>
  
  <pre><code>for (var in 1:10)
  {
    sprintf('I want to print this number: %d', var)
  }
  </code></pre>
  
  <p>Why is this happening? is there another function which can make this for me?</p>