Update factors.Rmd (#624)

This commit is contained in:
Matt Herman 2018-06-20 05:00:59 -04:00 committed by Hadley Wickham
parent 8fee078c9d
commit 02502a6ebc
1 changed files with 2 additions and 2 deletions

View File

@ -209,8 +209,8 @@ Another type of reordering is useful when you are colouring the lines on a plot.
```{r, fig.align = "default", out.width = "50%", fig.width = 4}
by_age <- gss_cat %>%
filter(!is.na(age)) %>%
group_by(age, marital) %>%
count() %>%
count(age, marital) %>%
group_by(age) %>%
mutate(prop = n / sum(n))
ggplot(by_age, aes(age, prop, colour = marital)) +