Push the `knit` button! ```{r setup, child="exercise-setup.Rmd", eval = file.exists("exercise-setup.Rmd")} ``` ```{r, include = FALSE} knitr::opts_chunk$set( message = FALSE, error = FALSE, warning = FALSE ) ``` ```{r pkgs, message = FALSE, warning = FALSE} library(tidyverse) # contains ggplot2, dplyr, tidyr, etc library(ggthemes) library(ggmap) ``` ## `tuberculosis` dataset ```{r tb-data} tb <- read_csv(here::here("data/TB_notifications_2020-07-01.csv")) %>% dplyr::select(country, iso3, year, new_sp_m04:new_sp_fu) %>% pivot_longer(cols=new_sp_m04:new_sp_fu, names_to="sexage", values_to="count") %>% mutate(sexage = str_replace(sexage, "new_sp_", "")) %>% mutate(sex=substr(sexage, 1, 1), age=substr(sexage, 2, length(sexage))) %>% dplyr::select(-sexage) %>% filter(!(age %in% c("04", "014", "514", "u"))) %>% filter(year > 1996, year < 2013) %>% mutate(age_group = factor(age, labels = c("15-24", "25-34", "35-44", "45-54", "55-64", "65-"))) %>% dplyr::select(country, year, age_group, sex, count) # Filter Australia tb_oz <- tb %>% filter(country == "Australia") # Fix names for map joining tb_fixed <- tb %>% mutate(region=recode(country, "United States of America"="USA", "United Kingdom of Great Britain and Northern Ireland"="UK", "Russian Federation"="Russia", "Viet Nam"="Vietnam", "Venezuela (Bolivarian Republic of)"="Venezuela", "Bolivia (Plurinational State of)"="Bolivia", "Czechia"="Czech Republic", "Iran (Islamic Republic of)"="Iran", "Iran (Islamic Republic of)"="Laos", "Democratic People's Republic of Korea"="North Korea", "Republic of Korea"="South Korea", "United Republic of Tanzania"="Tanzania", "Congo"="Republic of Congo")) tb_2012 <- tb_fixed %>% #<< filter(year == 2012) %>% group_by(region) %>% summarise(count = sum(count)) ``` ## `platypus` dataset ```{r platypus} load(here::here("data/platypus.rda")) oz_bbox <- c(112.9, # min long -45, # min lat 159, # max long -10) # max lat oz_map <- get_map(location = oz_bbox, source = "osm") ``` ### Exercise 2.1: Polygon fill colour ```{r part2-exercise-02-01, echo = F, class = "target"} knitr::include_graphics("images/part2-exercise-02/part2-exercise-01-1.png") ``` ```{r part2-exercise-02-01s} # add your code here! ``` ### Exercise 2.2: Change the color palette ```{r part2-exercise-02-02, echo = F, class = "target"} knitr::include_graphics("images/part2-exercise-02/part2-exercise-02-1.png") ``` ```{r part2-exercise-02-02s} # add your code here! ``` ### Exercise 2.3: Density plot on map ```{r part2-exercise-02-03, echo = F, class = "target"} knitr::include_graphics("images/part2-exercise-02/part2-exercise-03-1.png") ``` ```{r part2-exercise-02-03s} # add your code here! ```