diff --git a/factors.Rmd b/factors.Rmd index 2f42a11..3fd38aa 100644 --- a/factors.Rmd +++ b/factors.Rmd @@ -125,7 +125,13 @@ ggplot(gss_cat, aes(race)) + scale_x_discrete(drop = FALSE) ``` -These levels represent valid values that simply did not occur in this dataset. Unfortunately, dplyr doesn't yet have a `drop` option, but it will in the future. +These levels represent valid values that simply did not occur in this dataset. In dplyr::count() set the `.drop` option to `FALSE`, to show these. + +```{r} +gss_cat %>% + count(race, + .drop = FALSE) +``` When working with factors, the two most common operations are changing the order of the levels, and changing the values of the levels. Those operations are described in the sections below.