From 0b5782dd457f148b155784fc54b5616f770ab29f Mon Sep 17 00:00:00 2001 From: Hadley Wickham Date: Thu, 17 Mar 2022 14:15:15 -0500 Subject: [PATCH] Updates for tidy data --- data-tidy.Rmd | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/data-tidy.Rmd b/data-tidy.Rmd index 2fe593a..9392522 100644 --- a/data-tidy.Rmd +++ b/data-tidy.Rmd @@ -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: ```{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(