title: How do I get all the output from script I am running in RStudio
body: <p>I want to see the output of a script that has 149 lines. All the way through the script there are tables that I want to see. I am using RStudio IDE. In the past I have used Tinn-R. I would run the whole script and the lines of code and the printed objects would be visible in the console. </p>
  
  <p>For instance, here is an excerpt</p>
  
  <pre><code>attach(uniquehuman.race.eth)
  partA.eth &lt;-table(Ethnicity, Sex,useNA="ifany")
  partA.eth
  margin.table(partA.eth,1)#row totals
  margin.table(partA.eth,2)#column totals
  nrow(uniquehuman.race.eth)#total logged in
  </code></pre>
  
  <p>The above code would give a text output of the tables and the numbers I needed. I could then save the console or copy and paste the whole thing in a text file. </p>
  
  <p>How can I do that in RStudio? The closest I come to it is hitting CTRL-ENTER on each line, but I do not want to do that 149 times. If I hit CTRL-SHIFT-ENTER for "run all", then R processes all the data and puts the objects into memory, but I do not see the output. </p>
  
  <p>Please tell me how I can see all the output and/or send the output to a text file. </p>