Fix/base-R typos and Figure 28.1 pepper caption (#1494)
This commit is contained in:
parent
dc95230a6d
commit
8d4fed1da0
|
@ -300,7 +300,7 @@ For this reason we sometimes joke that tibbles are lazy and surly: they do less
|
||||||
### Lists
|
### Lists
|
||||||
|
|
||||||
`[[` and `$` are also really important for working with lists, and it's important to understand how they differ from `[`.
|
`[[` and `$` are also really important for working with lists, and it's important to understand how they differ from `[`.
|
||||||
Lets illustrate the differences with a list named `l`:
|
Let's illustrate the differences with a list named `l`:
|
||||||
|
|
||||||
```{r}
|
```{r}
|
||||||
l <- list(
|
l <- list(
|
||||||
|
@ -349,8 +349,8 @@ If we suppose this pepper shaker is a list called `pepper`, then `pepper[1]` is
|
||||||
#| out-width: "100%"
|
#| out-width: "100%"
|
||||||
#| fig-cap: >
|
#| fig-cap: >
|
||||||
#| (Left) A pepper shaker that Hadley once found in his hotel room.
|
#| (Left) A pepper shaker that Hadley once found in his hotel room.
|
||||||
#| (Middle) `pepper[1]`.
|
#| (Middle) `pepper[[1]]`.
|
||||||
#| (Right) `pepper[[1]]`
|
#| (Right) `pepper[[1]][[1]]`
|
||||||
#| fig-alt: >
|
#| fig-alt: >
|
||||||
#| Three photos. On the left is a photo of a glass pepper shaker. Instead of
|
#| Three photos. On the left is a photo of a glass pepper shaker. Instead of
|
||||||
#| the pepper shaker containing pepper, it contains a single packet of pepper.
|
#| the pepper shaker containing pepper, it contains a single packet of pepper.
|
||||||
|
@ -443,7 +443,7 @@ for (element in vector) {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
The most straightforward use of `for` loops is to achieve the same affect as `walk()`: call some function with a side-effect on each element of a list.
|
The most straightforward use of `for` loops is to achieve the same effect as `walk()`: call some function with a side-effect on each element of a list.
|
||||||
For example, in @sec-save-database instead of using walk:
|
For example, in @sec-save-database instead of using walk:
|
||||||
|
|
||||||
```{r}
|
```{r}
|
||||||
|
|
Loading…
Reference in New Issue