Manual squash.

Closes #326
This commit is contained in:
hadley 2016-08-29 07:55:52 -05:00
parent 4df1dc8f62
commit fce7c2db32
1 changed files with 4 additions and 38 deletions

View File

@ -1,37 +1,3 @@
```{r include=FALSE, cache=FALSE}
set.seed(1014)
options(digits = 3)
knitr::opts_chunk$set(
comment = "#>",
collapse = TRUE,
cache = TRUE,
out.width = "70%",
fig.align = 'center',
fig.width = 6,
fig.asp = 0.618, # 1 / phi
fig.show = "hold"
)
options(dplyr.print_min = 6, dplyr.print_max = 6)
```
```{r include=FALSE, cache=FALSE}
set.seed(1014)
options(digits = 3)
knitr::opts_chunk$set(
comment = "#>",
collapse = TRUE,
cache = TRUE,
out.width = "70%",
fig.align = 'center',
fig.width = 6,
fig.asp = 0.618, # 1 / phi
fig.show = "hold"
)
options(dplyr.print_min = 6, dplyr.print_max = 6)
```
# R Markdown
## Introduction
@ -187,7 +153,7 @@ Chunks can be given an optional name: ```` ```{r by-name} ````. This has three a
1. You can set up networks of cached chunks to avoid re-performing expensive
computations on every run. More on that below.
There is one chunk name that imbues special behaviour: `setup`. When you're in a notebook mode, the chunk named setup will be run automatically once, before other code is ran.
There is one chunk name that imbues special behaviour: `setup`. When you're in a notebook mode, the chunk named setup will be run automatically once, before any other code is run.
### Chunk options
@ -234,7 +200,7 @@ Option | Run code | Show code | Output | Plots | Messages | Warnings
### Table
By default, R Markdown prints data frames and matrixes as you'd see them in the console:
By default, R Markdown prints data frames and matrices as you'd see them in the console:
```{r}
mtcars[1:5, ]
@ -285,7 +251,7 @@ Note that the chunks won't update if `a_very_large_file.csv` changes, because kn
rawdata <- readr::read_csv("a_very_large_file.csv")
`r chunk`
As your caching strategies get progressively more complicated, it's good idea to regularly clear out all your caches with `knitr::clean_cache()`.
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.
@ -323,7 +289,7 @@ When the report is knit, the results of these computations are inserted into the
> We have data about 53940 diamonds. Only 126 are larger than
> 2.5 carats. The distribution of the reminder 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 ridiculous degree of accuracy, and a `big.mark` to make numbers easier to read. I'll often combine these into a helper function:
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:
```{r}
comma <- function(x) format(x, digits = 2, big.mark = ",")