Thanks to Michelle Berry for the presentation outline document.
Websites used to construct this presentation:
May 7, 2015
Thanks to Michelle Berry for the presentation outline document.
Websites used to construct this presentation:
install.packages("rmarkdown")
A convenient tool for reproducible and dynamic reports with R!
knitr
.Use it to consolidate your code and document into a single file:
Easy to use with version control: Use with GitHub
YAML: A set of key value pairs at the start of your file. Begin and end the header with a line of three dashes (- - -)
R Studio template writes the YAML header for you
output: html_document
output: pdf_document
output: word_document
output: beamer_presentation (beamer slideshow - pdf)
output: ioslides_presentation (ioslides presentation - html)
Markdown is a simple formatting language that is easy to use
*
or +
sign
*
italics*
and **
bold**
. Can even include tables:First Header | Second Header |
---|---|
Content Cell | Content Cell |
Content Cell | Content Cell |
Code blocks display with fixed-width font
#quick summary library(ggplot2) min(diamonds$price)
## [1] 326
mean(diamonds$price)
## [1] 3932.8
max(diamonds$price)
## [1] 18823
x <- sample(1:100, 5) x
## [1] 90 94 19 49 48
You can name the code chunk.
echo = TRUE: The code will be displayed.
eval = TRUE: Yes, execute the code.
You may want to use the same set of chunk options throughout a document and you don't want to retype those options in every chunk.
Global chunk options are for you!
r
.Last night, I saw 7 shooting stars!
rmarkdown::render("<filepath>")
When you render, R will:
Execute each embedded code chunk and insert the results into your report.
Build a new version of your report in the output file type.
Open a preview of the output file in the viewer pane.
Save the output file in your working directory.