Minor missing values proofing from twitter feedback

Fixes #1025
This commit is contained in:
Hadley Wickham 2022-05-11 13:39:46 -05:00
parent 0ea0ce5e14
commit 1b782799b0
1 changed files with 4 additions and 4 deletions

View File

@ -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 |>