diff --git a/06-data-carpentry.Rmd b/06-data-carpentry.Rmd index 27c7497..eed7806 100644 --- a/06-data-carpentry.Rmd +++ b/06-data-carpentry.Rmd @@ -163,7 +163,7 @@ Splitting means taking a variable that is really two variables combined and crea agesex = c("m0-10", "f0-10") # create compound variable n = c(3, 5) # create a value for each observation agesex_df = tibble(agesex, n) # create a data frame -separate(agesex_df, agesex, c("age", "sex"), sep = 1) +separate(agesex_df, agesex, c("sex", "age"), sep = 1) ``` ```{r to-separate, echo=FALSE,} @@ -171,7 +171,7 @@ knitr::kable(agesex_df, caption = "Joined age and sex variables in one column") ``` ```{r separated, echo=FALSE} -knitr::kable(separate(agesex_df, agesex, c("age", "sex"), sep = 1), +knitr::kable(separate(agesex_df, agesex, c("sex", "age"), sep = 1), caption = "Age and sex variables separated by the function `separate`.") ```