Updates for tidy data

This commit is contained in:
Hadley Wickham 2022-03-17 14:15:15 -05:00
parent 3411382803
commit 0b5782dd45
1 changed files with 2 additions and 6 deletions

View File

@ -325,7 +325,7 @@ An alternative to `names_sep` is `names_pattern`, which you can use to extract v
### Data and variable names in the column headers
The next step up in complexity is when the column names include a mix of variable values and variable names.
For example, take the `family` dataset:
For example, take the `household` dataset:
```{r}
family
@ -338,7 +338,7 @@ We again we need to supply a vector to `names_to` but this time we use the speci
[^data-tidy-1]: Calling this `.value` instead of `.variable` seems confusing so I think we'll change it: <https://github.com/tidyverse/tidyr/issues/1326>
```{r}
family |>
household |>
pivot_longer(
cols = !family,
names_to = c(".value", "child"),
@ -530,10 +530,6 @@ country_tb |>
ggplot(aes(year, log10(count), group = country)) +
geom_line()
country
library(gapminder)
gapminder |>
pivot_wider(