Files corresponding to Short Course: Introduction to Data Science Using R
We’ll continue to work on the same .Rmd file from the previous exercise.
names <- c("Justin", "George", "Alexander", "Jacob", "Anderson")
barData <- BabyNamesFull %>%
filter(name %in% names) %>%
group_by(name) %>%
summarise(total = sum(count))
Use the data object created to create a bar plot with names on the
x-axis and the total count on the y-axis. You’ll need to specify
both the x and y variables and change the statistic to “identity” in
the geom_bar()
function.
Use the data object created by the code below to create a filled bar plot with the sex variable denoting the coloring of columns.
barDataSex <- BabyNamesFull %>%
filter(name %in% c("Shannon", "Lindsay", "Avery")) %>%
group_by(name, sex) %>%
summarise(total = sum(count))
## `summarise()` has grouped output by 'name'. You can override using the `.groups` argument.