How to save the console in R studio (input+output)

A few options to consider;

  1. You can copy and paste your console to a text file.
  2. In your History pane (next to Environment), you can select the save icon. This however won't save your output, just your input.
  3. If the purpose is to create a reproducible example, the reprex package is the way to go. GitHub - tidyverse/reprex: Render bits of R code for sharing, e.g., on GitHub or StackOverflow. This is great for short bits of r code and output.
  4. You should also check our rmarkdown notebooks. Note that even with R's file >> save feature, you won't save plots etc. With rmarkdown or rmarkdown notebooks, you can intermix markdown formatted text, code, and code output (including tables and plots). You then also may knit that into html or pdf documents. 3.2 Notebook | R Markdown: The Definitive Guide

And this is the most recent RStudio IDE support question I could find,

https://support.rstudio.com/hc/en-us/community/posts/115000852167-Saving-Script-and-Console-in-RStudio

1 Like