Saving Data - veeninglab/BactMAP GitHub Wiki
To save plots, use ggsave from the ggplot2 package:
ggsave(myPlot, filename="myPlot.PDF")
Alternatively, to save many plots in one PDF file, use cairo_pdf():
cairo_pdf("myPlots.PDF", onefile=TRUE)
myPlot1
myPlot2
myPlot3
dev.off()
To save R dataframes, use save:
save(myDataFrame, file="myDataFrame.Rda")
To save R dataframes as CSV, use write_csv from the package readr
:
#only run if you didn't install readr yet:
install.packages("readr")
#and save:
write_csv(myDataFrame, "myDataFrame.csv")