pipelines
play

pipelines Dr. Jennifer (Jenny) Bryan Department of Statistics and - PowerPoint PPT Presentation

pipelines Dr. Jennifer (Jenny) Bryan Department of Statistics and Michael Smith Laboratories University of British Columbia saving figures to file do not save figures mouse-y style not self-documenting not reproducible


  1. pipelines Dr. Jennifer (Jenny) Bryan Department of Statistics and Michael Smith Laboratories University of British Columbia

  2. saving figures to file

  3. do not save figures mouse-y style not self-documenting not reproducible http://cache.desktopnexus.com/thumbnails/180681-bigthumbnail.jpg

  4. most correct method: pdf("awesome_figure.pdf") plot(1:10) dev.off() postscript(), svg(), png(), tiff(), ....

  5. fine for everyday use: plot(1:10) dev.print(pdf,"awesome_figure.pdf") postscript(), svg(), png(), tiff(), ....

  6. • If the plot is on your screen ggsave("˜/path/to/figure/filename.png") • If your plot is assigned to an object ggsave(plot1, file = "˜/path/to/figure/filename.png") • Specify a size ggsave(file = "/path/to/figure/filename.png", width = 6, height =4) • or any format (pdf, png, eps, svg, jpg) ggsave(file = "/path/to/figure/filename.eps") ggsave(file = "/path/to/figure/filename.jpg") ggsave(file = "/path/to/figure/filename.pdf") Data Visualization with R & ggplot2 Karthik Ram

  7. typing in the R Console

  8. save commands in .r script, step through line by line w/ RStudio’s help

  9. source entire file with RStudio’s button

  10. source entire file from R command line > source('darwin.r')

  11. source entire file from another R script source(‘big_bang.r’) source(‘darwin.r’) source(‘zombie_apocalypse.r’)

  12. source entire file from shell $ Rscript darwin.r > darwin.rout or $ Rscript -e "knitr::stitch_rmd('darwin.r')"

  13. execute file from a Makefile darwin.html: darwin.r input-data.txt Rscript -e "knitr::stitch_rmd('darwin.r')"; rm -r darwin.md figure/*

Recommend


More recommend