Skip to content

Commit

Permalink
Updates for tidy data
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed Mar 17, 2022
1 parent 3411382 commit 0b5782d
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions data-tidy.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"),
Expand Down Expand Up @@ -530,10 +530,6 @@ country_tb |>
ggplot(aes(year, log10(count), group = country)) +
geom_line()
country
library(gapminder)
gapminder |>
pivot_wider(
Expand Down

0 comments on commit 0b5782d

Please sign in to comment.