Fix typos (#437)

* Fix typos

* Fix typos

* Fix typos
This commit is contained in:
behrman 2016-10-03 06:23:43 -07:00 committed by Hadley Wickham
parent 90d7766cef
commit 74cb7d57f6
3 changed files with 18 additions and 18 deletions

View File

@ -29,4 +29,4 @@ Communication is the theme of the following four chapters:
"analysis notebook" and how to systematically record your successes and
failures so that you can learn from them.
Unfortunately these chapters focus mostly on the technical mechanics of communication, not the really hard problems of communicating your thoughts to other humans. However, there are lot of other great books about communication, which we'll point you to at the end of each chapter.
Unfortunately, these chapters focus mostly on the technical mechanics of communication, not the really hard problems of communicating your thoughts to other humans. However, there are lot of other great books about communication, which we'll point you to at the end of each chapter.

View File

@ -10,14 +10,14 @@ R Markdown files are designed to be used in three ways:
not the code behind the analysis.
1. For collaborating with other data scientists (including future you!), who
are interested in both your conclusions, and how you reached them (i.e
are interested in both your conclusions, and how you reached them (i.e.
the code).
1. As an environment in which to _do_ data science, as a modern day lab
notebook where you can capture not only what you did, but also what you
were thinking.
R Markdown integrates a number of R packages and external tools. This means that helps is, by-and-large, not available through `?`. Instead, as you work through chapter, and use R Markdown in the future, keep these resources close to hand:
R Markdown integrates a number of R packages and external tools. This means that helps is, by-and-large, not available through `?`. Instead, as you work through this chapter, and use R Markdown in the future, keep these resources close to hand:
* R Markdown Cheat Sheet: _Help > Cheatsheets > R Markdown Cheat Sheet_,
or from <http://rstudio.com/cheatsheets>.
@ -27,7 +27,7 @@ R Markdown integrates a number of R packages and external tools. This means that
### Prerequisites
You need the __rmarkdown__ package, but you don't need to explicit install it or load it, as RStudio automatically does both when needed.
You need the __rmarkdown__ package, but you don't need to explicitly install it or load it, as RStudio automatically does both when needed.
```{r setup, include = FALSE}
chunk <- "```"
@ -48,13 +48,13 @@ It contains three important types of content:
1. __Chunks__ of R code surrounded by ```` ``` ````.
1. Text mixed with simple text formatting like `##` and .
When you open an `.Rmd` you get a notebook interface where code and output are interleaved. You can run each code chunk by clicking the Run icon (it looks like a play button at the top of the chunk), or by pressing Cmd/Ctrl + Shift + Enter. RStudio executes the code and displays the results inline with the code:
When you open an `.Rmd`, you get a notebook interface where code and output are interleaved. You can run each code chunk by clicking the Run icon (it looks like a play button at the top of the chunk), or by pressing Cmd/Ctrl + Shift + Enter. RStudio executes the code and displays the results inline with the code:
```{r, echo = FALSE, out.width = "75%"}
knitr::include_graphics("rmarkdown/diamond-sizes-notebook.png")
```
To produce a complete report containing all text, code, and results click "Knit" or press Cmd/Ctrl + Shift + K. You can also do programmatically with `rmarkdown::render("1-example.Rmd")`. This will display the report in the viewer pane, and create a self-contained HTML file that you can share with others.
To produce a complete report containing all text, code, and results, click "Knit" or press Cmd/Ctrl + Shift + K. You can also do this programmatically with `rmarkdown::render("1-example.Rmd")`. This will display the report in the viewer pane, and create a self-contained HTML file that you can share with others.
```{r, echo = FALSE, out.width = "75%"}
knitr::include_graphics("rmarkdown/diamond-sizes-report.png")
@ -87,14 +87,14 @@ The following sections dives into the three components of an R Markdown document
copy the YAML header from one to the other?
1. Create one new R Markdown document for each of the three built-in
formats: HTML, PDF and word. Knit each of the three documents.
formats: HTML, PDF and Word. Knit each of the three documents.
How does the output differ? How does the input differ? (You may need
to install LaTeX in order to build the PDF output --- RStudio will
prompt you if this is necessary.)
## Text formatting with Markdown
Prose in `.Rmd` files is written in Markdown, a light weight set of conventions for formatting plain text files. Markdown is designed to be easy to read and easy to write. It is also very easy to learn. The guide below shows how to use Pandoc's Markdown, a slightly extended version of Markdown that R Markdown understands.
Prose in `.Rmd` files is written in Markdown, a lightweight set of conventions for formatting plain text files. Markdown is designed to be easy to read and easy to write. It is also very easy to learn. The guide below shows how to use Pandoc's Markdown, a slightly extended version of Markdown that R Markdown understands.
```{r, echo = FALSE, comment = ""}
cat(readr::read_file("rmarkdown/markdown.Rmd"))
@ -221,7 +221,7 @@ There are also a rich set of options for controlling how figures embedded. You'l
### Caching
Normally, each knit of a document starts from a completely clean slate. This is great for reproducibility, because it ensures that you've captured every important computation in code. However, it can be painful if you have some computations that take a long time. The solution is `cache = TRUE`. When set, this will save the output of the chunk to a specially named file on disk. On subsequent runs, knitr will check to see if the code has changed, and if it hasn't, it will re-use the cached results.
Normally, each knit of a document starts from a completely clean slate. This is great for reproducibility, because it ensures that you've captured every important computation in code. However, it can be painful if you have some computations that take a long time. The solution is `cache = TRUE`. When set, this will save the output of the chunk to a specially named file on disk. On subsequent runs, knitr will check to see if the code has changed, and if it hasn't, it will reuse the cached results.
The caching system must be used with care, because by default it is based on the code only, not its dependencies. For example, here the `processed_data` chunk depends on the `raw_data` chunk:
@ -253,7 +253,7 @@ Note that the chunks won't update if `a_very_large_file.csv` changes, because kn
As your caching strategies get progressively more complicated, it's a good idea to regularly clear out all your caches with `knitr::clean_cache()`.
I've used the advice of [David Robinson](https://twitter.com/drob/status/738786604731490304) to name these chunks: each chunked is named after the primary object that it creates. This makes it easier to understand the `dependson` specification.
I've used the advice of [David Robinson](https://twitter.com/drob/status/738786604731490304) to name these chunks: each chunk is named after the primary object that it creates. This makes it easier to understand the `dependson` specification.
### Global options
@ -282,12 +282,12 @@ There is one other way to embed R code into an R Markdown document: directly int
> We have data about `r inline('nrow(diamonds)')` diamonds.
> Only `r inline('nrow(diamonds) - nrow(smaller)')` are larger
> than 2.5 carats. The distribution of the reminder is shown below:
> than 2.5 carats. The distribution of the remainder is shown below:
When the report is knit, the results of these computations are inserted into the text:
> We have data about 53940 diamonds. Only 126 are larger than
> 2.5 carats. The distribution of the reminder is shown below:
> 2.5 carats. The distribution of the remainder is shown below:
When inserting numbers into text, `format()` is your friend. It allows you to set the number of `digits` so you don't print to a ridiculous degree of accuracy, and a `big.mark` to make numbers easier to read. I'll often combine these into a helper function:
@ -318,7 +318,7 @@ comma(.12358124331)
## YAML header
You can control many other "whole document" settings by tweaking the parameters of the YAML header. You might wonder what YAML stands for: it's "yet another markup language", which is designed for representing hierarchical data in a way that's easy for humans to read and write. R Markdown uses it to control many details of the output. Here we'll discuss two: document parameters, and bibliographies.
You can control many other "whole document" settings by tweaking the parameters of the YAML header. You might wonder what YAML stands for: it's "yet another markup language", which is designed for representing hierarchical data in a way that's easy for humans to read and write. R Markdown uses it to control many details of the output. Here we'll discuss two: document parameters and bibliographies.
### Parameters
@ -372,7 +372,7 @@ bibliography: rmarkdown.bib
You can use many common bibliography formats including BibLaTeX, BibTeX, endnote, medline.
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 :
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 examples:
```markdown
Separate multiple citations with a `;`: Blah blah [@smith04; @doe99].
@ -383,11 +383,11 @@ Blah blah [see @doe99, pp. 33-35; also @smith04, ch. 1].
Remove the square brackets to create an in-text citation: @smith04
says blah, or @smith04 [p. 33] says blah.
Add a `-` before the citation to supress the author's name:
Add a `-` before the citation to suppress the author's name:
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`.
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 bibliography 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 reference a CSL (citation style language) file to the `csl` field:
@ -402,7 +402,7 @@ As with the bibliography field, your csl file should contain a path to the file.
R Markdown is still relatively young, and is still growing rapidly. The best place to stay on top of innovations is the official R Markdown website: <http://rmarkdown.rstudio.com>.
There are two important topics that we haven't covered here: collaboration, and the details of accurately communicating your ideas to other humans. Collaboration is a vital part of modern data science, and you can make your life much easier by using version control tools, like Git and Github. We recommend two free resources that will teach you about Git:
There are two important topics that we haven't covered here: collaboration, and the details of accurately communicating your ideas to other humans. Collaboration is a vital part of modern data science, and you can make your life much easier by using version control tools, like Git and GitHub. We recommend two free resources that will teach you about Git:
1. "Happy Git with R": a user friendly introduction to Git and GitHub from
R users, by Jenny Bryan. The book is freely available online:

View File

@ -14,7 +14,7 @@ smaller <- diamonds %>%
We have data about `r nrow(diamonds)` diamonds. Only
`r nrow(diamonds) - nrow(smaller)` are larger than
2.5 carats. The distribution of the reminder is shown
2.5 carats. The distribution of the remainder is shown
below:
```{r, echo = FALSE}