diff --git a/tidy.Rmd b/tidy.Rmd index 8a079e8..a7aa088 100644 --- a/tidy.Rmd +++ b/tidy.Rmd @@ -526,9 +526,9 @@ I've shown you the code a piece at a time, assigning each interim result to a ne ```{r, results = "hide"} who %>% - gather(code, value, new_sp_m014:newrel_f65, na.rm = TRUE) %>% - mutate(code = stringr::str_replace(code, "newrel", "new_rel")) %>% - separate(code, c("new", "var", "sexage")) %>% + gather(key, value, new_sp_m014:newrel_f65, na.rm = TRUE) %>% + mutate(key = stringr::str_replace(key, "newrel", "new_rel")) %>% + separate(key, c("new", "var", "sexage")) %>% select(-new, -iso2, -iso3) %>% separate(sexage, c("sex", "age"), sep = 1) ```