Update rmarkdown-formats.Rmd (#328)

Typos
This commit is contained in:
S'busiso Mkhondwane 2016-08-28 15:13:50 +02:00 committed by Hadley Wickham
parent 134a318e52
commit f0ba226d5f
1 changed files with 7 additions and 7 deletions

View File

@ -2,7 +2,7 @@
## Introduction
So far you've seen R Markdown used it to produce HTML documents. This chapter gives a brief overview of some of the many other types of output you can produce with R Markdown. There are two ways to set the output of a document:
So far you've seen R Markdown used to produce HTML documents. This chapter gives a brief overview of some of the many other types of output you can produce with R Markdown. There are two ways to set the output of a document:
1. Permanently, by modifying the the YAML header:
@ -111,7 +111,7 @@ output:
## Presentations
You can also use R Markdown to produce presentations. You get less visual control that with a tool like Keynote or Powerpoint, but automatically inserting the results of your R code into a presentation can save a huge amount of time. Presentations work by dividig your content into slides, with a new slide beginning at each first (`#`) or second (`##`) level header. You can also insert a horizontal rule (`***`) to create a new slide without a header.
You can also use R Markdown to produce presentations. You get less visual control that with a tool like Keynote or Powerpoint, but automatically inserting the results of your R code into a presentation can save a huge amount of time. Presentations work by dividing your content into slides, with a new slide beginning at each first (`#`) or second (`##`) level header. You can also insert a horizontal rule (`***`) to create a new slide without a header.
R Markdown comes with three presentations formats built-in:
@ -158,7 +158,7 @@ Any HTML format (document, notebook, presentation, or dashboard) can contain int
### htmlwidgets
HTML is an interactive format, and you can take advantage of that interactivity with __htmlwidgets__, R functions that produce interactivce html visualizations. For example, take the __leaflet__ map below. If you're viewing this page on the web, you can drag the map around, zoom in and out, etc. You obviously can't do that on a book, so rmarkdown automatically inserts a static screenshot for you.
HTML is an interactive format, and you can take advantage of that interactivity with __htmlwidgets__, R functions that produce interactive html visualisations. For example, take the __leaflet__ map below. If you're viewing this page on the web, you can drag the map around, zoom in and out, etc. You obviously can't do that on a book, so rmarkdown automatically inserts a static screenshot for you.
```{r}
library(leaflet)
@ -168,7 +168,7 @@ leaflet() %>%
addMarkers(174.764, 36.877, popup = "Maunga Whau")
```
The great thing about htmlwidgets is that you don't need to know anything about HTML or javascipt to use them. All the details are wrapped inside the package so you don't need to worry about it.
The great thing about htmlwidgets is that you don't need to know anything about HTML or javascript to use them. All the details are wrapped inside the package so you don't need to worry about it.
There are many packages that provide htmlwidgets, including:
@ -186,7 +186,7 @@ To learn more about htmlwidgets and see a more complete list of packages that pr
### Shiny
htmlwidgets provide __client-side__ interactivity --- all the interactive happens in the browser, independently of R. On one hand, that's great because you can distribute the HTML file without any connection to R. However, that fundamentally limits what you can do to things that have been implemented in HTML and javascript. An alternative approach is to use __shiny__, a package that allows you to creative interactivity using R code, not javascript.
htmlwidgets provide __client-side__ interactivity --- all the interactive happens in the browser, independently of R. On one hand, that's great because you can distribute the HTML file without any connection to R. However, that fundamentally limits what you can do to things that have been implemented in HTML and javascript. An alternative approach is to use __shiny__, a package that allows you to create interactivity using R code, not javascript.
To call Shiny code from an R Markdown document, add `runtime: shiny` to the header:
@ -209,7 +209,7 @@ knitr::include_graphics("screenshots/rmarkdown-shiny.png")
```
You can then refer to the values with `input$name` and `input$age`, and the code that uses them will be automatically re-run whenever they change.
I can't show you a live shiny app here because shiny interations occur on the __server-side__. This means you can write interactive apps without knowing javascript, but it means that you need a server to run it on. This introduces a logistical issue: Shiny apps need a Shiny server to be run online. When you run shiny apps on your own computer, shiny automatically sets up a shiny server for you, but you need a public facing shiny server if you want to publish this sort of interactivity online. That's the fundamental trade-off of shiny: you can do anything in a shiny document that you can do in R, but it that requires someone to be running R.
I can't show you a live shiny app here because shiny interactions occur on the __server-side__. This means you can write interactive apps without knowing javascript, but it means that you need a server to run it on. This introduces a logistical issue: Shiny apps need a Shiny server to be run online. When you run shiny apps on your own computer, shiny automatically sets up a shiny server for you, but you need a public facing shiny server if you want to publish this sort of interactivity online. That's the fundamental trade-off of shiny: you can do anything in a shiny document that you can do in R, but it that requires someone to be running R.
Learn more about Shiny at <http://shiny.rstudio.com/>.
@ -253,7 +253,7 @@ See <http://rmarkdown.rstudio.com/formats.html> for a list of even more formats.
## Learning more
To learn more about effective communcation in these different formats I recommend the following resources:
To learn more about effective communication in these different formats I recommend the following resources:
* To improve your presentation skills, I recommend
[_Presentation Patterns_](https://amzn.com/0321820800), by Neal Ford,