Using R Plots in Documents
This article will teach you how to save R plots for use in documents. Plots created with the
ggplot2 package (henceforth called “ggplot”) will receive primary attention, but options for saving plots created with other packages will also be covered.
To learn about using ggplot to create plots, see the article on Data Visualization in R with ggplot2.
Generally speaking, in R, whatever we create and calculate during our session is not available once we end our session. That includes new variables we added to our dataset, models we fit, and plots we created. To use a plot in another document, we first need to save the plot by exporting it as a file.