Tweak figure sizing

This commit is contained in:
hadley 2016-01-07 08:33:03 -06:00
parent c018c6d0d2
commit d6905100ba
1 changed files with 10 additions and 10 deletions

View File

@ -80,7 +80,7 @@ x3 <- list(1, list(2, list(3)))
I draw them as follows:
```{r, echo = FALSE}
```{r, echo = FALSE, out.width = "75%"}
knitr::include_graphics("diagrams/lists-structure.png")
```
@ -129,7 +129,7 @@ a <- list(a = 1:3, b = "a string", c = pi, d = list(-1, -5))
Or visually:
```{r, echo = FALSE}
```{r, echo = FALSE, out.width = "75%"}
knitr::include_graphics("diagrams/lists-subsetting.png")
```
@ -137,13 +137,13 @@ knitr::include_graphics("diagrams/lists-subsetting.png")
It's easy to get confused between `[` and `[[`, but it's important to understand the difference. A few months ago I stayed at a hotel with a pretty interesting pepper shaker that I hope will help remember these differences:
```{r, echo = FALSE}
```{r, echo = FALSE, out.width = "25%"}
knitr::include_graphics("images/pepper.jpg")
```
If this pepper shaker is your list `x`, then, `x[1]` is a pepper shaker containing a single pepper packet:
```{r, echo = FALSE}
```{r, echo = FALSE, out.width = "25%"}
knitr::include_graphics("images/pepper-1.jpg")
```
@ -151,13 +151,13 @@ knitr::include_graphics("images/pepper-1.jpg")
`x[[1]]` is:
```{r, echo = FALSE}
```{r, echo = FALSE, out.width = "25%"}
knitr::include_graphics("images/pepper-2.jpg")
```
If you wanted to get the content of the pepper package, you'd need `x[[1]][[1]]`:
```{r, echo = FALSE}
```{r, echo = FALSE, out.width = "25%"}
knitr::include_graphics("images/pepper-3.jpg")
```
@ -533,7 +533,7 @@ x %>% transpose() %>% str()
Graphically, this looks like:
```{r, echo = FALSE}
```{r, echo = FALSE, out.width = "75%"}
knitr::include_graphics("diagrams/lists-transpose.png")
```
@ -644,7 +644,7 @@ map2(mu, sigma, rnorm, n = 10)
`map2()` generates this series of function calls:
```{r, echo = FALSE}
```{r, echo = FALSE, out.width = "75%"}
knitr::include_graphics("diagrams/lists-map2.png")
```
@ -672,7 +672,7 @@ args1 %>% pmap(rnorm) %>% str()
That looks like:
```{r, echo = FALSE}
```{r, echo = FALSE, out.width = "75%"}
knitr::include_graphics("diagrams/lists-pmap-unnamed.png")
```
@ -685,7 +685,7 @@ args2 %>% pmap(rnorm) %>% str()
That generates longer, but safer, calls:
```{r, echo = FALSE}
```{r, echo = FALSE, out.width = "75%"}
knitr::include_graphics("diagrams/lists-pmap-named.png")
```