title: How can I get the output of the summary() command if it is called within a loop?
body: <p>Suppose <code>Z</code> is a vector of feature names.</p>
  
  <p>How can I get the summary command in the following Rscript to actually print?</p>
  
  <pre><code>for (var in Z)                
  {                             
  #cat(i)                       
  form = paste('crim ~', var)   
  lm.fit=lm(form, data=Boston)  
  summary(lm.fit)               
  }                             
  </code></pre>
  
  <p>If I type <code>summary(lm.fit)</code> at the R prompt, it works, but when I source the Rscript which contains this loop, I get no output. I have already tried the solution <a href="https://stackoverflow.com/questions/9959337/how-can-i-run-an-r-script-without-suppressing-output">How can I run an &#39;R&#39; script without suppressing output?</a> but it does not cause summary to print.</p>