8000 Use reorder_within() in Chapter 5. Closes #47. · codingbooks/tidy-text-mining@12e121e · GitHub
[go: up one dir, main page]

Skip to content

Commit 12e121e

Browse files
committed
Use reorder_within() in Chapter 5. Closes juliasilge#47.
1 parent e751c3c commit 12e121e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

05-document-term-matrices.Rmd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,12 @@ inaug_tf_idf %>%
140140
group_by(document) %>%
141141
top_n(10, tf_idf) %>%
142142
ungroup() %>%
143-
mutate(term = reorder(term, tf_idf)) %>%
143+
mutate(term = reorder_within(term, tf_idf, document)) %>%
144144
ggplot(aes(term, tf_idf, fill = document)) +
145145
geom_col(show.legend = FALSE) +
146146
facet_wrap(~ document, scales = "free") +
147147
coord_flip() +
148+
scale_x_reordered() +
148149
labs(x = "",
149150
y = "tf-idf")
150151
```

0 commit comments

Comments
 (0)
0