diff --git a/base-R.qmd b/base-R.qmd index c4b3719..a3d9a12 100644 --- a/base-R.qmd +++ b/base-R.qmd @@ -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. diff --git a/diagrams/pepper.graffle b/diagrams/pepper.graffle index 154c70e..d68d6ed 100644 Binary files a/diagrams/pepper.graffle and b/diagrams/pepper.graffle differ diff --git a/diagrams/pepper.png b/diagrams/pepper.png index 05780ed..effbfe0 100644 Binary files a/diagrams/pepper.png and b/diagrams/pepper.png differ