diff --git a/missing-values.Rmd b/missing-values.Rmd index 3dfee88..d841571 100644 --- a/missing-values.Rmd +++ b/missing-values.Rmd @@ -61,7 +61,7 @@ x <- c(1, 4, 5, 7, NA) coalesce(x, 0) ``` -You could use `mutate()` together with `across()` to apply to every this treatment to (say) every numeric column in a data frame: +You could use `mutate()` together with `across()` to apply this treatment to (say) every numeric column in a data frame: ```{r, eval = FALSE} df |> @@ -127,9 +127,9 @@ stocks <- tibble( This dataset has two missing observations: -- The `price` in the fourth quarter of 2021 is explicitly missing, because its value is `NA`. +- The `price` in the fourth quarter of 2020 is explicitly missing, because its value is `NA`. -- The `price` for the first quarter of 2022 is implicitly missing, because it simply does not appear in the dataset. +- The `price` for the first quarter of 2021 is implicitly missing, because it simply does not appear in the dataset. One way to think about the difference is with this Zen-like koan: @@ -257,7 +257,7 @@ ggplot(health, aes(smoker)) + ``` The same problem comes up more generally with `dplyr::group_by()`. -You can request that all factor levels be preserved with `.drop = TRUE`: +And again you can use `.drop = FALSE` to preserve all factor levels: ```{r} health |>