Visualizing questions and answers in tags
In the last exercise, you modified the posts_with_tags table to add a year column, and aggregated by type, year, and tag_name. The modified table has been preloaded for you as by_type_year_tag, and has one observation for each type (question/answer), year, and tag. Let's create a plot to examine the information that the table contains about questions and answers for the dplyr and ggplot2 tags. The ggplot2 package has been preloaded for you.
by_type_year_tag <- posts_with_tags %>%
mutate(year = year(creation_date)) %>%
count(type, year, tag_name)
Diese Übung ist Teil des Kurses
Joining Data with dplyr
Anleitung zur Übung
- Filter the
by_type_year_tagtable for the dplyr and ggplot2 tags. - Create a line plot with that filtered table that plots the frequency (
n) over time, colored by question/answer and faceted by tag.
Interaktive Übung
Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.
# Filter for the dplyr and ggplot2 tag names
by_type_year_tag_filtered <- by_type_year_tag %>%
filter(___)
# Create a line plot faceted by the tag name
ggplot(by_type_year_tag_filtered, aes(___, ___, color = ___)) +
geom_line() +
facet_wrap(~ tag_name)