Fix pepper diagram (#1499)

Update caption and remove duplicated sentence
This commit is contained in:
Hadley Wickham 2023-05-25 10:47:24 -05:00 committed by GitHub
parent 015ab7b48a
commit a9d29a02c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 3 deletions

View File

@ -338,7 +338,6 @@ l <- list(
The difference between `[` and `[[` is particularly important for lists because `[[` drills down into the list while `[` returns a new, smaller list.
To help you remember the difference, take a look at the unusual pepper shaker shown in @fig-pepper.
If this pepper shaker is your list `pepper`, then, `pepper[1]` is a pepper shaker containing a single pepper packet.
If we suppose this pepper shaker is a list called `pepper`, then `pepper[1]` is a pepper shaker containing a single pepper packet.
`pepper[2]` would look the same, but would contain the second packet.
`pepper[1:2]` would be a pepper shaker containing two pepper packets.
`pepper[[1]]` would extract the pepper packet itself.
@ -349,8 +348,8 @@ If we suppose this pepper shaker is a list called `pepper`, then `pepper[1]` is
#| out-width: "100%"
#| fig-cap: >
#| (Left) A pepper shaker that Hadley once found in his hotel room.
#| (Middle) `pepper[[1]]`.
#| (Right) `pepper[[1]][[1]]`
#| (Middle) `pepper[1]`.
#| (Right) `pepper[[1]]`
#| fig-alt: >
#| 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.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 809 KiB

After

Width:  |  Height:  |  Size: 478 KiB