diff --git a/images/inline-1-heat.png b/images/inline-1-heat.png
new file mode 100644
index 0000000..e8580bf
Binary files /dev/null and b/images/inline-1-heat.png differ
diff --git a/images/markdown-1-markup.png b/images/markdown-1-markup.png
new file mode 100644
index 0000000..9f46eaa
Binary files /dev/null and b/images/markdown-1-markup.png differ
diff --git a/images/slides-1-viridis.png b/images/slides-1-viridis.png
new file mode 100644
index 0000000..08a826b
Binary files /dev/null and b/images/slides-1-viridis.png differ
diff --git a/reproducible-research.Rmd b/reproducible-research.Rmd
index 5740ce1..b77c307 100644
--- a/reproducible-research.Rmd
+++ b/reproducible-research.Rmd
@@ -19,7 +19,7 @@ install.packages("rmarkdown")
## Basics
-[This](https://github.com/hadley/r4ds/tree/master/rmarkdown-demos/1-example.Rmd) is an R Markdown file, a plain text file that has the extension `.Rmd`. Notice that it contains three types of content:
+[This](http://github.com/hadley/r4ds/tree/master/rmarkdown-demos/1-example.Rmd) is an R Markdown file, a plain text file that has the extension `.Rmd`. Notice that it contains three types of content:
* An (optional) YAML header surrounded by `---`s
* code chunks surrounded by ```
s
@@ -31,7 +31,7 @@ cat(htmltools::includeText("rmarkdown-demos/1-example.Rmd"))
### A Notebook Interface
-When you open the file in the RStudio IDE, it becomes a [notebook interface for R](http://rmarkdown.rstudio.com/r_notebooks.html). You can run each code chunk by clicking the Run icon (it looks like a play button at the top of the chunk). RStudio executes the code and display the results inline with your file.
+When you open the file in the RStudio IDE, it becomes a notebook interface for R. You can run each code chunk by clicking the Run icon (it looks like a play button at the top of the chunk). RStudio executes the code and displays the results inline with your file.
```{r, echo = FALSE, out.width = "100%"}
knitr::include_graphics("images/how-1-file.png")
@@ -39,7 +39,7 @@ knitr::include_graphics("images/how-1-file.png")
### Rendering output
-To generate a report from the file, run the `render()` command:
+To generate a report from an R Markdown file, run the `render()` command:
```{r eval = FALSE}
library(rmarkdown)
@@ -66,7 +66,7 @@ This may sound complicated, but R Markdown makes it extremely simple by encapsul
## Get Started
-To open a new .Rmd file, open the RStudio IDE and select File > New File > R Markdown... in the menubar. RStudio will launch a wizard that you can use to pre-populate your file with useful content. You can erase or add to the content as you wish.
+To open a new .Rmd file, open the RStudio IDE and select *File > New File > R Markdown...* in the menubar. RStudio will launch a wizard that you can use to pre-populate your file with useful content. You can erase or add to the content as you wish.
## Code Chunks
@@ -76,13 +76,13 @@ You can quickly insert code chunks into your file with
* the Add Chunk icon in the editor toolbar (it looks like a green box with a C in it)
* or by typing the chunk delimiters ` ```{r} ` and ` ``` `.
-Test chunks as you write by clicking the "Run Current Chunk" and "Run All Chunks Above" icons at the top of each chunk. R Markdown will run the code in the chunks in your current environment and display the results in your file editor. To turn off this behavior, click the gear icon at the top of the .Rmd file and select "Chunk Output in the Console." RStudio will then run code chunks at the command line as if your .Rmd file were an R Script.
+Test code as you write by clicking the "Run Current Chunk" and "Run All Chunks Above" icons at the top of each chunk. R Markdown will run the code in the chunks in your current environment and display the results in your file editor. To turn off this behavior, click the gear icon at the top of the .Rmd file and select "Chunk Output in the Console." RStudio will then run code chunks at the command line as if your .Rmd file were an R Script.
-When you render your .Rmd file, R Markdown will create a fresh environment to run the code chunks in. It will run each code chunk in order and embed the results beneath the chunk in your final report.
+When you render your .Rmd file, R Markdown will create a fresh environment to run the code chunks in. It will run each chunk, in order, and embed the results beneath the chunk in your final report.
### Chunk Options
-Chunk output can be customized with [knitr options](http://yihui.name/knitr/options/), arguments set in the `{}` of a chunk header. For example, the above file uses five arguments:
+Chunk output can be customized with [knitr options](http://yihui.name/knitr/options/), arguments set in the `{}` of a chunk header. For example, the above file (1-example.Rmd) uses five arguments:
* `include = FALSE` prevents code and results from appearing in the finished file. R Markdown still runs the code in the chunk, and the results can be used by other chunks.
* `echo = FALSE` prevents code, but not the results from appearing in the finished file. This is a useful way to embed figures.
@@ -90,8 +90,6 @@ Chunk output can be customized with [knitr options](http://yihui.name/knitr/opti
* `warning = FALSE` prevents warnings that are generated by code from appearing in the finished.
* `fig.cap = "..."` adds a caption to graphical results.
-See the [R Markdown Reference Guide](https://www.rstudio.com/wp-content/uploads/2015/03/rmarkdown-reference.pdf) for a complete list of knitr chunk options.
-
Knitr provides almost 60 options that you can use to customize your code chunks. Since the options are not associated with an R function, it can be difficult to figure out where to learn about them. The best place is the knitr options web page at
```
+This text is displayed verbatim / preformatted
+```
+
+
+#### LaTeX Equations
+
+Use latex math syntax to create formatted equations.
+
+Inline equation:
+```markdown
+$E = mc^{2}$
+```
+
+Display equation:
+```markdown
+$$E = mc^{2}$$
+```
+
+#### Manual Line Breaks
+
+End a line with two or more spaces:
+
+```markdown
+Roses are red,
+Violets are blue.
+```
+
+#### Paragraphs
+
+Insert a blank line at the end of a paragraph:
+
+```markdown
+Paragraph 1.
+
+Paragraph 2.
+Still paragraph 2.
+```
+
+#### Horizontal Rule / Page Break
+
+Three or more asterisks or dashes:
+
+```markdown
+***
+
+---
+```
+
+#### Tables
+
+```markdown
+First Header | Second Header
+------------- | -------------
+Content Cell | Content Cell
+Content Cell | Content Cell
+Reference Style Links and Images
+```
+
+### Bibliographies and Citations
+
+Pandoc can automatically generate citations and a bibliography in a number of styles. To use this feature, specify a bibliography file using the `bibliography` field in your file's header. The field should contain a filepath from the directory that contains your .Rmd file to the file that contains the bibliography file:
+
+```yaml
+---
+title: "Markdown Demo"
+output: html_document
+bibliography: rmarkdown.bib
+---
+```
+
+You can use any of the following formats: .bib (BibLaTeX), .bibtex (BibTeX), .copac (Copac), .enl (EndNote), .json (JSON citeproc), .medline (MEDLINE), .mods (MODS), .ris (RIS),
+.wos (ISI), .xml (XML).
+
+To create a citation within your .Rmd file, use a key composed of ‘@’ + the citation identifier from the bibliography file. Then place the citation in square brackets. Here are some example citations from rmarkdown.rstudio.com. Notice that you can
+
+* Separate multiple citations with a `;`
+* Remove the square brackets to create an in-text citation
+* Add a `-` before the citation to supress the author's name
+
+```markdown
+Blah blah [see @doe99, pp. 33-35; also @smith04, ch. 1].
+
+Blah blah [@doe99, pp. 33-35, 38-39 and *passim*].
+
+Blah blah [@smith04; @doe99].
+
+@smith04 says blah.
+
+@smith04 [p. 33] says blah.
+
+Smith says blah [-@smith04].
+```
+
+When R Markdown renders your file, it will build and append a bibliography to the end of your document. The bibliography will contain each of the cited references from your bibiliography file, but it will not contain a section heading. As a result it is common practice to end your file with a section header for the bibliography, such as `# References` or `# Bibliography`.
+
+You can change the style of your citations and bibliography by adding a CSL 1.0 style file to the `csl` field of your file's header.
+
+```yaml
+---
+title: "Markdown Demo"
+output: html_document
+bibliography: rmarkdown.bib
+csl: apa.csl
+---
+```
+
+As with the bibliography field, your csl file should contain a filepath to the file (here I assume that the csl file is in the same directory as the .Rmd file). http://github.com/citation-style-language/styles contains a useful repository of CSL style files.
-* Headers
-* Lists
-* Links
-* Images
-* Block quotes
-* Latex equations
-* Horizontal rules
-* Tables
-* Slide breaks
-* Italicized text
-* Bold text
-* Superscripts
-* Subscripts
-* Strikethrough text
-* Footnotes
-* Bibliographies and Citations
## Output Formats
-Set the `output_format` argument of `render()` to render your .Rmd file into any of R Markdown's supported formats. For example, the code below renders [1-example.Rmd](rmarkdown-demos/1-example.Rmd) to a Microsoft Word document:
+Set the `output_format` argument of `render()` to render your .Rmd file into any of R Markdown's supported formats. For example, the code below renders [1-example.Rmd](http://github.com/hadley/r4ds/tree/master/rmarkdown-demos/1-example.Rmd) to a Microsoft Word document:
```{r eval = FALSE}
library(rmarkdown)
render("1-example.Rmd", output_format = "word_document")
```
-If you do not select a format, R Markdown renders the file to its default format, which you can set in the `output` field of a .Rmd file's header. The header of [1-example.Rmd](rmarkdown-demos/1-example.Rmd) shows that it renders to an HTML file by default:
+If you do not select a format, R Markdown renders the file to its default format, which you can set in the `output` field of a .Rmd file's header. The header of [1-example.Rmd](http://github.com/hadley/r4ds/tree/master/rmarkdown-demos/1-example.Rmd) shows that it renders to an HTML file by default:
```{r eval = FALSE}
---
@@ -267,39 +488,39 @@ RStudio's knit button renders a file to the first format listed in its `output`
knitr::include_graphics("images/outputs-2-pdf.png")
```
-The following output formats are available to use with R Markdown.
+The menu contains a list of formats that are similar to the default format. To update the list, change the default format in your YAML. The following output formats are available to use with R Markdown.
### Documents
-* [html_notebook]( http://rmarkdown.rstudio.com/r_notebooks.html) - Interactive R Notebooks
-* [html_document](http://rmarkdown.rstudio.com/html_document_format.html) - HTML document w/ Bootstrap CSS
-* [pdf_document](http://rmarkdown.rstudio.com/pdf_document_format.html) - PDF document (via LaTeX template)
-* [word_document](http://rmarkdown.rstudio.com/word_document_format.html) - Microsoft Word document (docx)
-* [odt_document](http://rmarkdown.rstudio.com/odt_document_format.html) - OpenDocument Text document
-* [rtf_document](http://rmarkdown.rstudio.com/rtf_document_format.html) - Rich Text Format document
-* [md_document](http://rmarkdown.rstudio.com/markdown_document_format.html) - Markdown document (various flavors)
+* `html_notebook` - Interactive R Notebooks
+* `html_document` - HTML document w/ Bootstrap CSS
+* `pdf_document` - PDF document (via LaTeX template)
+* `word_document` - Microsoft Word document (docx)
+* `odt_document` - OpenDocument Text document
+* `rtf_document` - Rich Text Format document
+* `md_document` - Markdown document (various flavors)
### Presentations (slides)
-* [ioslides_presentation](http://rmarkdown.rstudio.com/ioslides_presentation_format.html) - HTML presentation with ioslides
-* [revealjs::revealjs_presentation](http://rmarkdown.rstudio.com/revealjs_presentation_format.html) - HTML presentation with reveal.js. Requires the revealjs package.
-* [slidy_presentation](http://rmarkdown.rstudio.com/slidy_presentation_format.html) - HTML presentation with W3C Slidy
-* [beamer_presentation](http://rmarkdown.rstudio.com/beamer_presentation_format.html) - PDF presentation with LaTeX Beamer
+* `ioslides_presentation` - HTML presentation with ioslides
+* `revealjs::revealjs_presentation` - HTML presentation with reveal.js. Requires the revealjs package.
+* `slidy_presentation` - HTML presentation with W3C Slidy
+* `beamer_presentation` - PDF presentation with LaTeX Beamer
### More
-* [flexdashboard::flex_dashboard](http://rmarkdown.rstudio.com/flexdashboard/) - Administrative dashboards. Requires the flexdashboard package.
-* [tufte::tufte_handout](http://rmarkdown.rstudio.com/tufte_handout_format.html) - PDF handouts in the style of Edward Tufte. Requires the tufte package.
-* [tufte::tufte_html](http://rmarkdown.rstudio.com/tufte_handout_format.html) - HTML handouts in the style of Edward Tufte. Requires the tufte package.
-* [tufte::tufte_book](http://rmarkdown.rstudio.com/tufte_handout_format.html) - PDF books in the style of Edward Tufte. Requires the tufte package.
-* [html_vignette](http://rmarkdown.rstudio.com/package_vignette_format.html) - R package vignette (HTML)
-* [github_document](http://rmarkdown.rstudio.com/github_document_format.html) - GitHub Flavored Markdown document
+* `flexdashboard::flex_dashboard` - Administrative dashboards. Requires the flexdashboard package.
+* `tufte::tufte_handout` - PDF handouts in the style of Edward Tufte. Requires the tufte package.
+* `tufte::tufte_html` - HTML handouts in the style of Edward Tufte. Requires the tufte package.
+* `tufte::tufte_book` - PDF books in the style of Edward Tufte. Requires the tufte package.
+* `html_vignette` - R package vignette (HTML)
+* `github_document` - GitHub Flavored Markdown document
-You can also build [books](https://bookdown.org/), [websites](http://rmarkdown.rstudio.com/rmarkdown_websites.html), and [interactive documents](http://rmarkdown.rstudio.com/authoring_shiny.html) with R Markdown, as described in the sections below.
+You can also build books, websites, and interactive documents with R Markdown, as described in the sections below.
### Output Options
-Each output format is implemented as a function in R. You can customize the output by passing arguments to the function as sub-values of the `output` field. For example, we can change [1-example.Rmd](rmarkdown-demos/1-example.Rmd) to render with a floating table of contents,
+Each output format is implemented as a function in R, e.g. `html_document()`. To customize a format, pass arguments to the output function as sub-values of the `output` field. For example, we can change [1-example.Rmd](http://github.com/hadley/r4ds/tree/master/rmarkdown-demos/1-example.Rmd) to render with a floating table of contents,
```{r, echo = FALSE, out.width = "100%"}
knitr::include_graphics("images/outputs-3-toc.png")
@@ -309,7 +530,7 @@ To learn which arguments a format takes, read the format's help page in R, e.g.
## HTML Notebooks
-In How It Works, you learned that R Markdown files provide a notebook interface that makes it easy to test and iterate when writing code.
+In How It Works, you learned that R Markdown files provide a notebook interface for editing that makes it easy to test and iterate your code.
To share this experience with colleagues, simply share your .Rmd file for them to open in their RStudio IDE. If your colleagues do not use R, you can recreate the notebook interface by rendering your file to an HTML notebook with `output: html_notebook`.
@@ -332,11 +553,14 @@ Each format will intuitively divide your content into slides, with a new slide b
Insert a horizontal rule (`***`) into your document to create a manual slide break. Create bullet points that display incrementally with `>-`. Here is a version of 1-example.Rmd displayed as a reveal.js slide presentation.
-TO DO - IMAGE
+```{r, echo = FALSE, out.width = "100%"}
+knitr::include_graphics("images/slides-1-viridis.png")
+```
+
## Dashboards
-Dashboards are a useful way to communicate large amounts of information visually and quickly. Create one with the `flex_dashboard` output format of the flexdashboard package, as in the [.Rmd file below](rmarkdown-demos/11-dashboard.Rmd):
+Dashboards are a useful way to communicate large amounts of information visually and quickly. Create one with the `flex_dashboard` output format of the flexdashboard package, as in the [.Rmd file below](http://github.com/hadley/r4ds/tree/master/rmarkdown-demos/11-dashboard.Rmd):
Flexdashboard makes it easy to organize your content into a visual layout:
@@ -364,13 +588,14 @@ Use `rmarkdown::render_site()` to render collections of R Markdown documents int
* any support material
-Execute `rmarkdown::render_site("