Closed
Description
In the Barplot section of the ggplot lesson, the narrative text says that we want to create a dataframe with "the percent of each house type in each village." However, the code calculates percentages across the entire dataset, not by village. Note that the totals for each village are clearly well below 100%.
The code should be
percent_wall_type <- interviews_plotting %>%
filter(respondent_wall_type != "cement") %>%
count(village, respondent_wall_type) %>%
group_by(village) %>%
mutate(percent = n / sum(n))
ungroup()
Metadata
Assignees
Labels
No labels
Activity