Australian Animal Outcomes
Data manipulation, Web Scraping (rvest package) and SelectorGadget, Animated Choropleth Map
Notable topics: Data manipulation, Web Scraping (rvest package) and SelectorGadget, Animated Choropleth Map
Recorded on: 2020-07-20
Timestamps by: Eric Fletcher
Screencast
Timestamps
Using use_tidytemplate to open the project dataset with the package's tidytemplate Rmd
Using rename to rename Total column to total
Using fct_reorder to reorder stacked barplot with weight = sum
Using fct_lump with w = n to lump together outcome factor levels displaying the most frequenct with rest lumped into other
Using fct_recode to combine the factor level In Stock with Currently In Care
Using fct_reorder to reorder facet_wrap panels
Using scale_y_continuous with labels = comma to separate digits with comma
Using complete to complete account for missing combinations of data where the value is 0 in the released column
Using max (year) within filter to subset the data displaying only the most recent year
Using pivot_longer to pivot location variables from wide to long
Web Scaraping table from Wikipedia with SelectorGadget and Rvest
Using str_to_upper to upper case the values in the shorthand column
Using parse_number to remove commas from population and area columns
Using bind_rows to bind the two web scraped tables from Wikipedia together by row and column
Using inner_join to combine the Wikipedia table with the original data set
Using mutate to create new per_capita_million column to show outcome on a per million people basis
Using summarize to create new column pct_euthanized showing percent of cats and dogs euthanized over time. Formula accounts for 0 values thus avoiding a resulting empty vector.
Using scale_y_continuous with labels = percent to add percentage sign to y-axis values
Create a choropleth map of Australia using an Australian States Shapefile using the sf and ggplot2 packages | Troubleshooting begins at 44:25 (downsizing / downsampling with sf_simplify)
Add animation to the map of Australia showing the percent of cats euthanized by region using gganimate
Summary of screencast