class: center, middle, inverse, title-slide # Becoming Familiar with R, the Tidyverse, + Making Good Charts ## Sep 10 Session of the LBJ Data Studio
###
Ethan Tenison
| Project Manager for Data Initiatives, UT Austin - RGK Center ###
Matt Worthington
| Sr. Project Manager for Data Initiatives, UT Austin - LBJ ###
September 10, 2021
--- background-image: url('assets/images/dir_stat.png') background-size: cover class: center, bottom, inverse --- class: middle .pull-left[ # About Me ] .pull-right[ * .orange[**Personal Background**]: Born and raised in San Antonio, Texas. Live in Austin with my wife and three kids. * .orange[**Education Backgrounds**]: English Studies, Special Education, and Public Policy * .orange[**Professional Backgrounds**]: Public School Teacher, School District Administrator, and Data Scientist. ] --- background-image: url('https://utexas-lbjp-data.github.io/assets/rmarkdown/slide_02.jpeg') background-size: cover class: center, bottom, inverse --- background-image: url('https://utexas-lbjp-data.github.io/assets/rmarkdown/slide_03.jpeg') background-size: cover class: center, bottom, inverse --- class: center # Tell Us About You https://www.menti.com/w983jx692v --- <div style='position: relative; padding-bottom: 56.25%; padding-top: 35px; height: 0; overflow: hidden;'><iframe sandbox='allow-scripts allow-same-origin allow-presentation' allowfullscreen='true' allowtransparency='true' frameborder='0' height='315' src='https://www.mentimeter.com/embed/7e9fc51ebd6e406fe26da3de9c0de32f/8dc0f12a3440' style='position: absolute; top: 0; left: 0; width: 100%; height: 100%;' width='420'></iframe></div> --- background-image: url('assets/images/hermione_spell_class.png') background-size: cover class: center, bottom, inverse ## .blue[How to understand R if you are new...] --- background-image: url('assets/images/hp_vs_r.png') background-size: cover class: center, bottom, inverse --- # How I Hope We End Today .pull-left[ #### Anywhere from here.. .rmd-img[![](https://media3.giphy.com/media/l0EwZ92cG9x9VPC7u/giphy.gif?cid=790b76118edecd6d0b794b704e7116316ccb7d0c3b4d378e&rid=giphy.gif&ct=g)] ] .pull-right[ #### to here. .rmd-img[![](https://media1.giphy.com/media/xT1R9IKI80368giYne/giphy.gif?cid=790b7611b023f5345d803015ac0a3ada474f508173d36f94&rid=giphy.gif&ct=g)] ] --- class: showcase-bg, section, center, middle # 🪄 Showcase --- # Census Spellbook: `tidycensus` .pull-left[ ```r library(tidycensus) # Create A List of Variables demvars <- c(White = "P005003", Black = "P005004", Asian = "P005006", Hispanic = "P004003") # Pull The Census Data harris <- get_decennial( geography = "tract", variables = demvars, state = "TX", county = "Harris County", geometry = TRUE, summary_var = "P001001" ) |> # Create pct column mutate(pct = 100 * (value / summary_value)) # Draw A Chart harris |> ggplot(aes(fill = pct)) + facet_wrap(~variable) + geom_sf(color = NA) + coord_sf(crs = 26915, datum=NA) + scale_fill_viridis_c() + theme_lbj() + labs(title="Population Demographics in Harris County", subtitle="US Census | 2010 Decennial Census") ``` ] .pull-right[ <img src="index_files/figure-html/unnamed-chunk-4-1.png" width="504" /> ] --- # Table Spellbook: `gt` .pull-left[ ```r library(gt) # Create A List of Variables demvars <- c(White = "P005003", Black = "P005004", Asian = "P005006", Hispanic = "P004003", AIAN = "P005005", NHOPI = "P005007", Other = "P003007",`Two or More` = "P003008") # Pull The Census Data harris <- get_decennial(geography = "county", variables = demvars, state = "TX", county = "Harris County", summary_var = "P001001") |> # Create pct column mutate(pct = (value / summary_value)) |> select(variable, value, pct) # Draw A Table harris |> gt() |> # Pass The Data To A gt table tab_header(title = md("**Demographics in Harris County**"), subtitle = "Harris County reported 4,092,459 residents in the 2010 Census. Here's how each demographic group compares to the total population.") |> tab_source_note(source_note = "Data: US Census | 2010 Decennial Census | pulled with {tidycensus} in R") |> fmt_number(columns = c("value")) |> fmt_percent(columns = c("pct")) |> cols_label( variable = md("**Group**"), value = md("**Population**"), pct = md("**Pct. of Total**") ) ``` ] .pull-right[
Demographics in Harris County
Harris County reported 4,092,459 residents in the 2010 Census. Here's how each demographic group compares to the total population.
Group
Population
Pct. of Total
White
1,349,646.00
32.98%
Black
754,258.00
18.43%
Asian
249,853.00
6.11%
Hispanic
1,671,540.00
40.84%
AIAN
8,150.00
0.20%
NHOPI
2,260.00
0.06%
Other
583,566.00
14.26%
Two or More
131,332.00
3.21%
Data: US Census | 2010 Decennial Census (pulled with {tidycensus} in R)
] --- # Static Charts: [`ggplot`]() .pull-left[ ![](https://pbs.twimg.com/media/DZ15NFRXUAAA_yJ?format=jpg&name=large) ] .pull-right[ ![](https://pbs.twimg.com/media/E9figN0WYAQOXWK?format=jpg&name=large) ] --- # Interactive Charts: [`highcharter`](https://jkunst.com/highcharter/index.html)
--- # Dashboards: `shiny` .pull-left[ #### Texas Workforce Commission ![](assets/images/twc_dashboard.png) ] .pull-right[ #### National Center for Farmworker Health ![](assets/images/ncfh_dashboard.png) ] --- # Websites: `blogdown` + `distill` .pull-left[ .center[#### [Blogdown](https://pkgs.rstudio.com/blogdown/)] ![](assets/images/blogdown.png) ] .pull-right[ .center[#### [Distill](https://pkgs.rstudio.com/distill/)] ![](assets/images/distill.png) ] --- # Books: `bookdown` .rmd-img[![](assets/images/bookdown.png)] --- # Documents: `rmarkdown` .rmd-img[![](assets/images/rmd_magic.png)] --- # Like anything, this is a journey... .rmd-img[![](https://github.com/allisonhorst/stats-illustrations/raw/master/rstats-artwork/r_rollercoaster.png )] --- class: journey-bg, section, center, middle, inverse # Let's get started 👟 --- # Downloading Materials .pull-left[ ### Today's Agenda .b--gray.ba.bw2.ma2.shadow-1[ * Navigating Rstudio * Rstudio Interface * R Projects * Basics of ggplot2 * `ggplot()` * `aes()` * `geom_*()` * `scale_*()` * `theme_*()` * `labs()` * Exporting Data & Charts * `ggsave()` ] ] .pull-right[ ### Today's Materials .b--gray.ba.bw2.ma2.pa2.shadow-1[ #### What You Should Download * [**ggplot2 Materials** ](https://tinyurl.com/making-ggplot2-charts): tinyurl.com/making-ggplot2-charts #### What You Should Reference Later * [**Today's Slides**](https://slides.lbjdata.org/data-studio/ggplot2_basics/index.html) * [**The ggplot2 Website**](https://ggplot2.tidyverse.org) * [**Chapter 1 of R For Data Science**](https://r4ds.had.co.nz/data-visualisation.html) * [**ggplot2 Cheatsheets**]() * [**ggplot2tor**](https://ggplot2tor.com) ] ] --- background-image: url('assets/images/rstudio_hex.png') background-size: cover class: center, bottom --- # Downloading The Materials * [**Rmarkdown Analysis** ](tinyurl.com/TXVaxUptake): tinyurl.com/TXVaxUptake ![](assets/images/github_repo.png) --- # Open the `.Rproj` file .rmd-img[![](assets/images/rproject.png)] --- background-image: url('https://utexas-lbjp-data.github.io/assets/rmarkdown/slide_17.jpeg') background-size: cover class: center, bottom, inverse --- background-image: url('https://utexas-lbjp-data.github.io/assets/rmarkdown/slide_18.jpeg') background-size: cover class: center, bottom, inverse --- background-image: url('assets/images/tidyverse_hex.png') background-size: cover class: center, bottom, inverse --- background-image: url('assets/images/tidyverse_network.png') background-size: cover class: center, bottom, inverse animated fadeIn --- background-image: url('assets/images/tidyverse_data_lifecycle_map.png') background-size: cover class: center, bottom, inverse animated fadeIn --- background-image: url('assets/images/lifecycle_focus.png') background-size: cover class: center, bottom, inverse animated fadeIn --- background-image: url('assets/images/what_todays_focus_will_be.png') background-size: cover class: center, bottom, inverse animated animate fadeIn --- background-image: url('assets/images/marie_kondo.png') background-size: cover class: center, bottom, inverse animated fadeIn --- # What is ggplot2? .pull-left.b--gray.ba.bw2.ma2.pa4.shadow-1[ * ["A coherent system for describing and building graphs"](https://r4ds.had.co.nz/data-visualisation.html) (✔️) * [A tool for implementing a Grammar of Graphics](https://ggplot2-book.org/introduction.html). (✔️) * [An R package named ggplot2](https://rmarkdown.rstudio.com/docs/). (✔️) * [A tool that people build on](https://exts.ggplot2.tidyverse.org) (✔️) * [A tool for making artwork](https://www.data-imaginist.com/art) (✔️) * [A tool for reproducible analysis](http://radar.oreilly.com/2011/07/wolframs-computational-documen.html) (✔️) * Really fun (🚀️) ] .pull-right[ .rmd-small[![](https://raw.githubusercontent.com/rstudio/hex-stickers/master/PNG/ggplot2.png)] ] .tl.burntorange[ Courtesy of Alison Presmanes Hill ([@apreshill](https://twitter.com/apreshill)) ] --- class: center middle .rmd-img[![](https://www.mrworthington.com/posts/school-finance-analysis/SFNationalMapPP.png)] --- class: center middle .rmd-tiniest[![](https://images.squarespace-cdn.com/content/v1/4f3f61bae4b063b909445965/1622454363382-U130NBNWBZMVGI2PF0YH/employed.png)] .tl.burntorange[ Credit: Georgios Karamanis ([@geokaramanis](https://twitter.com/geokaramanis)) ] --- class: center middle .rmd-med[![](https://raw.githubusercontent.com/Z3tt/TidyTuesday/master/plots/2020_08/2020_08_CarbonFoodprint_alt.png)] .tl.burntorange[ Credit: Cédric Scherer ([@CedScherer](https://twitter.com/CedScherer)) ] --- class: center middle .rmd-small[![](https://raw.githubusercontent.com/Z3tt/TidyTuesday/master/plots/2020_27/2020_27_Xmen_annotated.png)] .tl.burntorange[ Credit: Cédric Scherer ([@CedScherer](https://twitter.com/CedScherer)) ] --- class: center middle .rmd-small[![](https://www.data-imaginist.com/art/011_yonder/yonder1831_hu827b7f9bcd74231a2b6a7030989792b6_784253_0x1000_resize_q75_box.jpg)] .tl.burntorange[ Credit: Thomas Lin Pederson ([@thomasp85](https://twitter.com/thomasp85)) ] --- background-image: url('https://utexas-lbjp-data.github.io/assets/rmarkdown/slide_17.jpeg') background-size: cover class: center, bottom, inverse --- background-image: url('https://utexas-lbjp-data.github.io/assets/rmarkdown/slide_18.jpeg') background-size: cover class: center, bottom, inverse --- background-image: url('https://utexas-lbjp-data.github.io/assets/rmarkdown/slide_19.jpeg') background-size: cover class: center, bottom, inverse --- class: title center pipe-page # `|>` and `%>%` and `+` <code class ='r hljs remark-code'><b>leave_house</b>(<b>get_dressed</b>(<b>get_out_of_bed</b>(<b>wake_up</b>(<span style='color:#bf5700'>me</span>, <span style='color:#005f86'>time</span> = <span style='color:#bf5700'>"8:00"</span>), <span style='color:#005f86'>side</span> = <span style='color:#bf5700'>"correct"</span>), <span style='color:#005f86'>pants</span> = <span style='color:#bf5700'>TRUE</span>, <span style='color:#005f86'>shirt</span> = <span style='color:#bf5700'>TRUE</span>), <span style='color:#005f86'>car</span> = <span style='color:#bf5700'>TRUE</span>, <span style='color:#005f86'>bike</span> = <span style='color:#bf5700'>FALSE</span>)</code> -- <code class ='r hljs remark-code'>me <span style='background-color:#ffff7f'>|></span> <br> <b>wake_up</b>(<span style='color:#005f86'>time</span> = <span style='color:#bf5700'>"8:00"</span>) <span style='background-color:#ffff7f'>|></span> <br> <b>get_out_of_bed</b>(<span style='color:#005f86'>side</span> = <span style='color:#bf5700'>"correct"</span>) <span style='background-color:#ffff7f'>|></span> <br> <b>get_dressed</b>(<span style='color:#005f86'>pants</span> = <span style='color:#bf5700'>TRUE</span>, <span style='color:#005f86'>shirt</span> = <span style='color:#bf5700'>TRUE</span>) <span style='background-color:#ffff7f'>|></span> <br> <b>leave_house</b>(<span style='color:#005f86'>car</span> = <span style='color:#bf5700'>TRUE</span>, <span style='color:#005f86'>bike</span> = <span style='color:#bf5700'>FALSE</span>)</code> .tl.footnote-small[ Courtesy of Andrew Heiss ([@andrewheiss](https://twitter.com/andrewheiss)) ] --- class: vaccine-bg, section, center, middle, inverse # And now... making charts! --- class: center middle # The Grammar of Graphics .rmd-img[![](https://cdn-images-1.medium.com/max/800/1*MMZuYgeC_YjXNC1r4D4sog.png)] .tl.burntorange[ Credit: ([Dr Anna Krystalli](https://annakrystalli.me/rrresearchACCE20/plotting-with-ggplot2.html#the-grammar-of-grahics)) ] --- class: center middle # The Grammar of Graphics .rmd-img[![](https://cdn-images-1.medium.com/max/800/1*w1RnmuE7VRK9aCAbtW9KAQ.gif)] .tl.burntorange[ Credit: ([Dr Anna Krystalli](https://annakrystalli.me/rrresearchACCE20/plotting-with-ggplot2.html#the-grammar-of-grahics)) ] --- # ggplot2 Basics in Action .pull-left[ ```r library(ggplot2) library(ggthemes) diamonds |> # Call On Your Dataset ggplot() + # Draw A Canvas aes(cut, fill = cut) + # Define How The Data Gets Mapped geom_bar(show.legend = FALSE) + # Define What Kind of Chart to Draw labs( x = "Cut", # Specify X-Axis Label y = "Count", # Specify Y-Axis Label title = "A Fancy diamonds Plot", # Specify Title Label subtitle = "A compelling subtitle", # Specify Subtitle Label caption = "Source: ggplot2 package | Data: 'diamonds'" # Specify Source/Caption Label ) + theme_minimal() + # Add the minimal Theme theme(plot.title = element_text(color = "#bf5700")) + # Modify Title's Color ggthemes::scale_fill_tableau(palette = "Color Blind") # Add A Color Blind Friendly Palette ``` ] .pull-right[ <img src="index_files/figure-html/fancy_diamonds-1.png" width="504" /> ] --- class: center middle ## `ggplot()` **What it does:** Loads the data and draws a ggplot2 canvas for your chart .rmd-tiny[![](assets/images/ggplot_function.png)] --- class: center middle ## `aes()` **What it does:** Lets you dictate what goes where on the chart, like what's on the x-axis versus the y-axis or how stuff gets colored. .rmd-tiny[![](assets/images/aes_function.png)] --- class: center middle ## `geom_*()` **What it does:** Lets you add shapes to your charts (bars vs. points vs. lines vs. maps, etc.) .rmd-tiny[![](assets/images/geom_function.png)] --- class: center middle ## `labs()` **What it does:** Lets you add or adjust labels on your chart, like the Title, Subtitle, X-Axis, Y-Axis, or Caption Labels. .rmd-tiny[![](assets/images/labs_function.png)] --- class: center middle ## `theme_*()` **What it does:** Lets you add style to the chart! .rmd-tiny[![](assets/images/theme_function.png)] --- class: center middle ## `scale_*()` **What it does:** Lets you change or adjust things about scales you've mapped using `aes()`. .rmd-tiny[![](assets/images/scale_function.png)] --- count: false # A step by step view .panel1-fancy_diamonds-auto[ ```r *library(ggplot2) ``` ] .panel2-fancy_diamonds-auto[ ] --- count: false # A step by step view .panel1-fancy_diamonds-auto[ ```r library(ggplot2) *library(ggthemes) ``` ] .panel2-fancy_diamonds-auto[ ] --- count: false # A step by step view .panel1-fancy_diamonds-auto[ ```r library(ggplot2) library(ggthemes) *diamonds # Call On Your Dataset ``` ] .panel2-fancy_diamonds-auto[ ``` # A tibble: 53,940 × 10 carat cut color clarity depth table price x y z <dbl> <ord> <ord> <ord> <dbl> <dbl> <int> <dbl> <dbl> <dbl> 1 0.23 Ideal E SI2 61.5 55 326 3.95 3.98 2.43 2 0.21 Premium E SI1 59.8 61 326 3.89 3.84 2.31 3 0.23 Good E VS1 56.9 65 327 4.05 4.07 2.31 4 0.29 Premium I VS2 62.4 58 334 4.2 4.23 2.63 5 0.31 Good J SI2 63.3 58 335 4.34 4.35 2.75 6 0.24 Very Good J VVS2 62.8 57 336 3.94 3.96 2.48 7 0.24 Very Good I VVS1 62.3 57 336 3.95 3.98 2.47 8 0.26 Very Good H SI1 61.9 55 337 4.07 4.11 2.53 9 0.22 Fair E VS2 65.1 61 337 3.87 3.78 2.49 10 0.23 Very Good H VS1 59.4 61 338 4 4.05 2.39 # … with 53,930 more rows ``` ] --- count: false # A step by step view .panel1-fancy_diamonds-auto[ ```r library(ggplot2) library(ggthemes) diamonds %>% # Call On Your Dataset * ggplot() # Draw A Canvas ``` ] .panel2-fancy_diamonds-auto[ <img src="index_files/figure-html/fancy_diamonds_auto_04_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-fancy_diamonds-auto[ ```r library(ggplot2) library(ggthemes) diamonds %>% # Call On Your Dataset ggplot() + # Draw A Canvas * aes(cut, fill = cut) # Define How The Data Gets Mapped ``` ] .panel2-fancy_diamonds-auto[ <img src="index_files/figure-html/fancy_diamonds_auto_05_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-fancy_diamonds-auto[ ```r library(ggplot2) library(ggthemes) diamonds %>% # Call On Your Dataset ggplot() + # Draw A Canvas aes(cut, fill = cut) + # Define How The Data Gets Mapped * geom_bar(show.legend = FALSE) # Define What Kind of Chart to Draw ``` ] .panel2-fancy_diamonds-auto[ <img src="index_files/figure-html/fancy_diamonds_auto_06_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-fancy_diamonds-auto[ ```r library(ggplot2) library(ggthemes) diamonds %>% # Call On Your Dataset ggplot() + # Draw A Canvas aes(cut, fill = cut) + # Define How The Data Gets Mapped geom_bar(show.legend = FALSE) + # Define What Kind of Chart to Draw * labs( * x = "Cut", # Specify X-Axis Label * y = "Count", # Specify Y-Axis Label * title = "A Fancy diamonds Plot", # Specify Title Label * subtitle = "A compelling subtitle", # Specify Subtitle Label * caption = "Source: ggplot2 package | Data: 'diamonds'" # Specify Source/Caption Label * ) ``` ] .panel2-fancy_diamonds-auto[ <img src="index_files/figure-html/fancy_diamonds_auto_07_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-fancy_diamonds-auto[ ```r library(ggplot2) library(ggthemes) diamonds %>% # Call On Your Dataset ggplot() + # Draw A Canvas aes(cut, fill = cut) + # Define How The Data Gets Mapped geom_bar(show.legend = FALSE) + # Define What Kind of Chart to Draw labs( x = "Cut", # Specify X-Axis Label y = "Count", # Specify Y-Axis Label title = "A Fancy diamonds Plot", # Specify Title Label subtitle = "A compelling subtitle", # Specify Subtitle Label caption = "Source: ggplot2 package | Data: 'diamonds'" # Specify Source/Caption Label ) + * theme_minimal() # Add the minimal Theme ``` ] .panel2-fancy_diamonds-auto[ <img src="index_files/figure-html/fancy_diamonds_auto_08_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-fancy_diamonds-auto[ ```r library(ggplot2) library(ggthemes) diamonds %>% # Call On Your Dataset ggplot() + # Draw A Canvas aes(cut, fill = cut) + # Define How The Data Gets Mapped geom_bar(show.legend = FALSE) + # Define What Kind of Chart to Draw labs( x = "Cut", # Specify X-Axis Label y = "Count", # Specify Y-Axis Label title = "A Fancy diamonds Plot", # Specify Title Label subtitle = "A compelling subtitle", # Specify Subtitle Label caption = "Source: ggplot2 package | Data: 'diamonds'" # Specify Source/Caption Label ) + theme_minimal() + # Add the minimal Theme * theme(plot.title = element_text(color = "#bf5700")) # Modify Title's Color ``` ] .panel2-fancy_diamonds-auto[ <img src="index_files/figure-html/fancy_diamonds_auto_09_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-fancy_diamonds-auto[ ```r library(ggplot2) library(ggthemes) diamonds %>% # Call On Your Dataset ggplot() + # Draw A Canvas aes(cut, fill = cut) + # Define How The Data Gets Mapped geom_bar(show.legend = FALSE) + # Define What Kind of Chart to Draw labs( x = "Cut", # Specify X-Axis Label y = "Count", # Specify Y-Axis Label title = "A Fancy diamonds Plot", # Specify Title Label subtitle = "A compelling subtitle", # Specify Subtitle Label caption = "Source: ggplot2 package | Data: 'diamonds'" # Specify Source/Caption Label ) + theme_minimal() + # Add the minimal Theme theme(plot.title = element_text(color = "#bf5700")) + # Modify Title's Color * scale_fill_tableau(palette = "Color Blind") # Add A Color Blind Friendly Palette ``` ] .panel2-fancy_diamonds-auto[ <img src="index_files/figure-html/fancy_diamonds_auto_10_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-fancy_diamonds-auto[ ```r library(ggplot2) library(ggthemes) diamonds %>% # Call On Your Dataset ggplot() + # Draw A Canvas aes(cut, fill = cut) + # Define How The Data Gets Mapped geom_bar(show.legend = FALSE) + # Define What Kind of Chart to Draw labs( x = "Cut", # Specify X-Axis Label y = "Count", # Specify Y-Axis Label title = "A Fancy diamonds Plot", # Specify Title Label subtitle = "A compelling subtitle", # Specify Subtitle Label caption = "Source: ggplot2 package | Data: 'diamonds'" # Specify Source/Caption Label ) + theme_minimal() + # Add the minimal Theme theme(plot.title = element_text(color = "#bf5700")) + # Modify Title's Color scale_fill_tableau(palette = "Color Blind") # Add A Color Blind Friendly Palette ``` ] .panel2-fancy_diamonds-auto[ <img src="index_files/figure-html/fancy_diamonds_auto_11_output-1.png" width="504" /> ] <style> .panel1-fancy_diamonds-auto { color: black; width: 38.6060606060606%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-fancy_diamonds-auto { color: black; width: 59.3939393939394%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-fancy_diamonds-auto { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> --- class: code50 # Our Data ```r library(tidyverse) # Core Set of R Data Science Tools (dplyr, ggplot2, tidyr, readr, etc.) library(ggthemes) # ggplot2 extension package that has themes + functions # Import Texas County Data ------------------------------------------------ tx_cnty_data <- read_rds("raw_data/texas_cnty_data.rds") # Review Data Available --------------------------------------------------- glimpse(tx_cnty_data) ## Preview The Data ``` ``` Rows: 254 Columns: 28 $ county <chr> "Anderson", "Andrews", "… $ public_health_region_phr <chr> "4/5N", "9/10", "4/5N", … $ total_doses_allocated <dbl> 17870, 6100, 58100, 6840… $ vaccine_doses_administered <chr> "39286", "14009", "65694… $ people_vaccinated_with_at_least_one_dose <chr> "22765", "7770", "37278"… $ people_fully_vaccinated <dbl> 18919, 6525, 31129, 1199… $ population_12 <dbl> 50661, 14863, 72486, 208… $ population_16 <chr> "48045", "13503", "67056… $ population_65 <dbl> 8658, 1833, 14422, 6791,… $ population_phase_1a_healthcare_workers <chr> "2051", "309", "6534", "… $ population_phase_1a_long_term_care_residents <chr> "833", "106", "1752", "2… $ population_16_64_any_medical_condition <chr> "20206", "5450", "28054"… $ population_education_and_child_care_personnel <chr> "1574", "41", "3266", "3… $ confirmed_cases <dbl> 4837, 2280, 6086, 1740, … $ probable_cases <dbl> 2089, 0, 5970, 511, 130,… $ fatalities <dbl> 142, 49, 323, 52, 13, 7,… $ prez_candidate_2020 <chr> "Donald J Trump", "Donal… $ vote_share_2020 <dbl> 0.786, 0.843, 0.725, 0.7… $ tot_pop <dbl> 57810, 18036, 87322, 244… $ med_inc <dbl> 43455, 76158, 50453, 451… $ broadband <dbl> 83.6, 91.6, 89.5, 90.9, … $ labor_part_16 <dbl> 41.4, 64.9, 58.2, 51.6, … $ unemployment <dbl> 3.2, 3.7, 6.6, 7.5, 2.8,… $ w_health_insurance <dbl> 85.5, 80.2, 81.2, 80.0, … $ geometry <MULTIPOLYGON [°]> MULTIPOLYGO… $ pct_vaccinated_eligible <dbl> 0.3734431, 0.4390096, 0.… $ pct_vaccinated_all <dbl> 0.3272617, 0.3617764, 0.… $ share_above_65 <dbl> 0.14976648, 0.10163007, … ``` --- # 1. Top 10 Chart .pull-left[ ```r # 1. Draw A Bar Chart ----------------------------------------------------- ## Subset the Top 10 Counties for Vaccine Uptake top_10_vax <- tx_cnty_data |> arrange(desc(pct_vaccinated_eligible)) |> slice(1:10) ## Draw Bar Chart of Top 10 Counties top_10_vax |> ggplot() + aes(x=reorder(county, pct_vaccinated_eligible), y = pct_vaccinated_eligible, fill = pct_vaccinated_eligible) + geom_col() + scale_y_continuous(labels = scales::percent) + theme_minimal() + theme(legend.position = "none", plot.title = element_text(face = "bold")) + labs(title = "Top 10 Counties for Vacine Uptake", subtitle = "As of September 9th, 2021", caption = "Data: Texas Department of State Health Services", x = "Counties", y = "% Fully Vaccinated (Population 12+)") ``` ] .pull-right[ <img src="index_files/figure-html/draw-viz-1-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-1-auto[ ```r # 1. Draw A Bar Chart ----------------------------------------------------- ## Subset the Top 10 Counties for Vaccine Uptake *top_10_vax <- tx_cnty_data ``` ] .panel2-draw-viz-1-auto[ ] --- count: false # A step by step view .panel1-draw-viz-1-auto[ ```r # 1. Draw A Bar Chart ----------------------------------------------------- ## Subset the Top 10 Counties for Vaccine Uptake top_10_vax <- tx_cnty_data %>% * arrange(desc(pct_vaccinated_eligible)) ``` ] .panel2-draw-viz-1-auto[ ] --- count: false # A step by step view .panel1-draw-viz-1-auto[ ```r # 1. Draw A Bar Chart ----------------------------------------------------- ## Subset the Top 10 Counties for Vaccine Uptake top_10_vax <- tx_cnty_data %>% arrange(desc(pct_vaccinated_eligible)) %>% * slice(1:10) ``` ] .panel2-draw-viz-1-auto[ ] --- count: false # A step by step view .panel1-draw-viz-1-auto[ ```r # 1. Draw A Bar Chart ----------------------------------------------------- ## Subset the Top 10 Counties for Vaccine Uptake top_10_vax <- tx_cnty_data %>% arrange(desc(pct_vaccinated_eligible)) %>% slice(1:10) ## Draw Bar Chart of Top 10 Counties *top_10_vax ``` ] .panel2-draw-viz-1-auto[ ``` Simple feature collection with 10 features and 27 fields Geometry type: MULTIPOLYGON Dimension: XY Bounding box: xmin: -106.6456 ymin: 25.83738 xmax: -95.42412 ymax: 32.00253 Geodetic CRS: NAD83 # A tibble: 10 × 28 county public_health_r… total_doses_all… vaccine_doses_a… people_vaccinat… <chr> <chr> <dbl> <chr> <chr> 1 Presidio 9/10 5300 10802 6053 2 Webb 11 206550 383755 222300 3 Starr 11 43780 82960 47909 4 Cameron 11 377955 548307 307452 5 Maverick 8 46700 77596 48312 6 Hidalgo 11 641140 1082649 610221 7 El Paso 9/10 713000 1074306 595876 8 Fort Bend 6/5S 528850 1004811 553677 9 Travis 7 2165090 1551208 864715 10 Hudspeth 9/10 2000 5415 3166 # … with 23 more variables: people_fully_vaccinated <dbl>, population_12 <dbl>, # population_16 <chr>, population_65 <dbl>, # population_phase_1a_healthcare_workers <chr>, # population_phase_1a_long_term_care_residents <chr>, # population_16_64_any_medical_condition <chr>, # population_education_and_child_care_personnel <chr>, confirmed_cases <dbl>, # probable_cases <dbl>, fatalities <dbl>, prez_candidate_2020 <chr>, … ``` ] --- count: false # A step by step view .panel1-draw-viz-1-auto[ ```r # 1. Draw A Bar Chart ----------------------------------------------------- ## Subset the Top 10 Counties for Vaccine Uptake top_10_vax <- tx_cnty_data %>% arrange(desc(pct_vaccinated_eligible)) %>% slice(1:10) ## Draw Bar Chart of Top 10 Counties top_10_vax %>% * ggplot() ``` ] .panel2-draw-viz-1-auto[ <img src="index_files/figure-html/draw-viz-1_auto_05_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-1-auto[ ```r # 1. Draw A Bar Chart ----------------------------------------------------- ## Subset the Top 10 Counties for Vaccine Uptake top_10_vax <- tx_cnty_data %>% arrange(desc(pct_vaccinated_eligible)) %>% slice(1:10) ## Draw Bar Chart of Top 10 Counties top_10_vax %>% ggplot() + * aes(x=reorder(county, pct_vaccinated_eligible), y = pct_vaccinated_eligible, fill = pct_vaccinated_eligible) ``` ] .panel2-draw-viz-1-auto[ <img src="index_files/figure-html/draw-viz-1_auto_06_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-1-auto[ ```r # 1. Draw A Bar Chart ----------------------------------------------------- ## Subset the Top 10 Counties for Vaccine Uptake top_10_vax <- tx_cnty_data %>% arrange(desc(pct_vaccinated_eligible)) %>% slice(1:10) ## Draw Bar Chart of Top 10 Counties top_10_vax %>% ggplot() + aes(x=reorder(county, pct_vaccinated_eligible), y = pct_vaccinated_eligible, fill = pct_vaccinated_eligible) + * geom_col() ``` ] .panel2-draw-viz-1-auto[ <img src="index_files/figure-html/draw-viz-1_auto_07_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-1-auto[ ```r # 1. Draw A Bar Chart ----------------------------------------------------- ## Subset the Top 10 Counties for Vaccine Uptake top_10_vax <- tx_cnty_data %>% arrange(desc(pct_vaccinated_eligible)) %>% slice(1:10) ## Draw Bar Chart of Top 10 Counties top_10_vax %>% ggplot() + aes(x=reorder(county, pct_vaccinated_eligible), y = pct_vaccinated_eligible, fill = pct_vaccinated_eligible) + geom_col() + * scale_y_continuous(labels = scales::percent) ``` ] .panel2-draw-viz-1-auto[ <img src="index_files/figure-html/draw-viz-1_auto_08_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-1-auto[ ```r # 1. Draw A Bar Chart ----------------------------------------------------- ## Subset the Top 10 Counties for Vaccine Uptake top_10_vax <- tx_cnty_data %>% arrange(desc(pct_vaccinated_eligible)) %>% slice(1:10) ## Draw Bar Chart of Top 10 Counties top_10_vax %>% ggplot() + aes(x=reorder(county, pct_vaccinated_eligible), y = pct_vaccinated_eligible, fill = pct_vaccinated_eligible) + geom_col() + scale_y_continuous(labels = scales::percent) + * theme_minimal() ``` ] .panel2-draw-viz-1-auto[ <img src="index_files/figure-html/draw-viz-1_auto_09_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-1-auto[ ```r # 1. Draw A Bar Chart ----------------------------------------------------- ## Subset the Top 10 Counties for Vaccine Uptake top_10_vax <- tx_cnty_data %>% arrange(desc(pct_vaccinated_eligible)) %>% slice(1:10) ## Draw Bar Chart of Top 10 Counties top_10_vax %>% ggplot() + aes(x=reorder(county, pct_vaccinated_eligible), y = pct_vaccinated_eligible, fill = pct_vaccinated_eligible) + geom_col() + scale_y_continuous(labels = scales::percent) + theme_minimal() + * theme(legend.position = "none", * plot.title = element_text(face = "bold")) ``` ] .panel2-draw-viz-1-auto[ <img src="index_files/figure-html/draw-viz-1_auto_10_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-1-auto[ ```r # 1. Draw A Bar Chart ----------------------------------------------------- ## Subset the Top 10 Counties for Vaccine Uptake top_10_vax <- tx_cnty_data %>% arrange(desc(pct_vaccinated_eligible)) %>% slice(1:10) ## Draw Bar Chart of Top 10 Counties top_10_vax %>% ggplot() + aes(x=reorder(county, pct_vaccinated_eligible), y = pct_vaccinated_eligible, fill = pct_vaccinated_eligible) + geom_col() + scale_y_continuous(labels = scales::percent) + theme_minimal() + theme(legend.position = "none", plot.title = element_text(face = "bold")) + * labs(title = "Top 10 Counties for Vacine Uptake", * subtitle = "As of September 9th, 2021", * caption = "Data: Texas Department of State Health Services", * x = "Counties", * y = "% Fully Vaccinated (Population 12+)") ``` ] .panel2-draw-viz-1-auto[ <img src="index_files/figure-html/draw-viz-1_auto_11_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-1-auto[ ```r # 1. Draw A Bar Chart ----------------------------------------------------- ## Subset the Top 10 Counties for Vaccine Uptake top_10_vax <- tx_cnty_data %>% arrange(desc(pct_vaccinated_eligible)) %>% slice(1:10) ## Draw Bar Chart of Top 10 Counties top_10_vax %>% ggplot() + aes(x=reorder(county, pct_vaccinated_eligible), y = pct_vaccinated_eligible, fill = pct_vaccinated_eligible) + geom_col() + scale_y_continuous(labels = scales::percent) + theme_minimal() + theme(legend.position = "none", plot.title = element_text(face = "bold")) + labs(title = "Top 10 Counties for Vacine Uptake", subtitle = "As of September 9th, 2021", caption = "Data: Texas Department of State Health Services", x = "Counties", y = "% Fully Vaccinated (Population 12+)") ``` ] .panel2-draw-viz-1-auto[ <img src="index_files/figure-html/draw-viz-1_auto_12_output-1.png" width="504" /> ] <style> .panel1-draw-viz-1-auto { color: black; width: 38.6060606060606%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-draw-viz-1-auto { color: black; width: 59.3939393939394%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-draw-viz-1-auto { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> --- # 2. Map 1 .pull-left[ ```r # 1. Map of Vaccine Uptake 12+ -------------------------------------------- tx_cnty_data %>% ggplot() + aes(fill = pct_vaccinated_eligible, color = pct_vaccinated_eligible) + geom_sf(size = 0.15) + scale_color_gradient_tableau(palette = "Blue", labels = scales::percent) + scale_fill_gradient_tableau(palette = "Blue", labels = scales::percent) + theme_void() + theme(legend.position = "right", plot.title = element_text(face = "bold")) + labs(title = "Vacine Uptake Among Eligible Residents", subtitle = "As of September 9th, 2021", caption = "Data: Texas Department of State Health Services", x = "Counties", y = "% Fully Vaccinated (Population 12+)", fill = "% Fully Vaccinated (12+)", color = "% Fully Vaccinated (12+)") ``` ] .pull-right[ ] --- count: false # A step by step view .panel1-draw-viz-2-auto[ ```r *# 1. Map of Vaccine Uptake 12+ ------------------------------------------- # 1. Map of Vaccine Uptake 12+ -------------------------------------------- ``` ] .panel2-draw-viz-2-auto[ ] --- count: false # A step by step view .panel1-draw-viz-2-auto[ ```r # 1. Map of Vaccine Uptake 12+ -------------------------------------------- # 1. Map of Vaccine Uptake 12+ -------------------------------------------- *tx_cnty_data ``` ] .panel2-draw-viz-2-auto[ ``` Simple feature collection with 254 features and 27 fields Geometry type: MULTIPOLYGON Dimension: XY Bounding box: xmin: -106.6456 ymin: 25.83738 xmax: -93.50829 ymax: 36.5007 Geodetic CRS: NAD83 # A tibble: 254 × 28 county public_health_r… total_doses_all… vaccine_doses_a… people_vaccinat… <chr> <chr> <dbl> <chr> <chr> 1 Anderson 4/5N 17870 39286 22765 2 Andrews 9/10 6100 14009 7770 3 Angelina 4/5N 58100 65694 37278 4 Aransas 11 6840 25402 14309 5 Archer 2/3 3200 6928 3879 6 Armstrong 1 2100 1266 711 7 Atascosa 8 19000 42788 24286 8 Austin 6/5S 8700 25127 14708 9 Bailey 1 24135 4722 2730 10 Bandera 8 5100 17602 10067 # … with 244 more rows, and 23 more variables: people_fully_vaccinated <dbl>, # population_12 <dbl>, population_16 <chr>, population_65 <dbl>, # population_phase_1a_healthcare_workers <chr>, # population_phase_1a_long_term_care_residents <chr>, # population_16_64_any_medical_condition <chr>, # population_education_and_child_care_personnel <chr>, confirmed_cases <dbl>, # probable_cases <dbl>, fatalities <dbl>, prez_candidate_2020 <chr>, … ``` ] --- count: false # A step by step view .panel1-draw-viz-2-auto[ ```r # 1. Map of Vaccine Uptake 12+ -------------------------------------------- # 1. Map of Vaccine Uptake 12+ -------------------------------------------- tx_cnty_data %>% * ggplot() ``` ] .panel2-draw-viz-2-auto[ <img src="index_files/figure-html/draw-viz-2_auto_03_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-2-auto[ ```r # 1. Map of Vaccine Uptake 12+ -------------------------------------------- # 1. Map of Vaccine Uptake 12+ -------------------------------------------- tx_cnty_data %>% ggplot() + * aes(fill = pct_vaccinated_eligible, color = pct_vaccinated_eligible) ``` ] .panel2-draw-viz-2-auto[ <img src="index_files/figure-html/draw-viz-2_auto_04_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-2-auto[ ```r # 1. Map of Vaccine Uptake 12+ -------------------------------------------- # 1. Map of Vaccine Uptake 12+ -------------------------------------------- tx_cnty_data %>% ggplot() + aes(fill = pct_vaccinated_eligible, color = pct_vaccinated_eligible) + * geom_sf(size = 0.15) ``` ] .panel2-draw-viz-2-auto[ <img src="index_files/figure-html/draw-viz-2_auto_05_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-2-auto[ ```r # 1. Map of Vaccine Uptake 12+ -------------------------------------------- # 1. Map of Vaccine Uptake 12+ -------------------------------------------- tx_cnty_data %>% ggplot() + aes(fill = pct_vaccinated_eligible, color = pct_vaccinated_eligible) + geom_sf(size = 0.15) + * scale_color_gradient_tableau(palette = "Blue", labels = scales::percent) ``` ] .panel2-draw-viz-2-auto[ <img src="index_files/figure-html/draw-viz-2_auto_06_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-2-auto[ ```r # 1. Map of Vaccine Uptake 12+ -------------------------------------------- # 1. Map of Vaccine Uptake 12+ -------------------------------------------- tx_cnty_data %>% ggplot() + aes(fill = pct_vaccinated_eligible, color = pct_vaccinated_eligible) + geom_sf(size = 0.15) + scale_color_gradient_tableau(palette = "Blue", labels = scales::percent) + * scale_fill_gradient_tableau(palette = "Blue", labels = scales::percent) ``` ] .panel2-draw-viz-2-auto[ <img src="index_files/figure-html/draw-viz-2_auto_07_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-2-auto[ ```r # 1. Map of Vaccine Uptake 12+ -------------------------------------------- # 1. Map of Vaccine Uptake 12+ -------------------------------------------- tx_cnty_data %>% ggplot() + aes(fill = pct_vaccinated_eligible, color = pct_vaccinated_eligible) + geom_sf(size = 0.15) + scale_color_gradient_tableau(palette = "Blue", labels = scales::percent) + scale_fill_gradient_tableau(palette = "Blue", labels = scales::percent) + * theme_void() ``` ] .panel2-draw-viz-2-auto[ <img src="index_files/figure-html/draw-viz-2_auto_08_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-2-auto[ ```r # 1. Map of Vaccine Uptake 12+ -------------------------------------------- # 1. Map of Vaccine Uptake 12+ -------------------------------------------- tx_cnty_data %>% ggplot() + aes(fill = pct_vaccinated_eligible, color = pct_vaccinated_eligible) + geom_sf(size = 0.15) + scale_color_gradient_tableau(palette = "Blue", labels = scales::percent) + scale_fill_gradient_tableau(palette = "Blue", labels = scales::percent) + theme_void() + * theme(legend.position = "right", * plot.title = element_text(face = "bold")) ``` ] .panel2-draw-viz-2-auto[ <img src="index_files/figure-html/draw-viz-2_auto_09_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-2-auto[ ```r # 1. Map of Vaccine Uptake 12+ -------------------------------------------- # 1. Map of Vaccine Uptake 12+ -------------------------------------------- tx_cnty_data %>% ggplot() + aes(fill = pct_vaccinated_eligible, color = pct_vaccinated_eligible) + geom_sf(size = 0.15) + scale_color_gradient_tableau(palette = "Blue", labels = scales::percent) + scale_fill_gradient_tableau(palette = "Blue", labels = scales::percent) + theme_void() + theme(legend.position = "right", plot.title = element_text(face = "bold")) + * labs(title = "Vacine Uptake Among Eligible Residents", * subtitle = "As of September 9th, 2021", * caption = "Data: Texas Department of State Health Services", * x = "Counties", * y = "% Fully Vaccinated (Population 12+)", * fill = "% Fully Vaccinated (12+)", * color = "% Fully Vaccinated (12+)") ``` ] .panel2-draw-viz-2-auto[ <img src="index_files/figure-html/draw-viz-2_auto_10_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-2-auto[ ```r # 1. Map of Vaccine Uptake 12+ -------------------------------------------- # 1. Map of Vaccine Uptake 12+ -------------------------------------------- tx_cnty_data %>% ggplot() + aes(fill = pct_vaccinated_eligible, color = pct_vaccinated_eligible) + geom_sf(size = 0.15) + scale_color_gradient_tableau(palette = "Blue", labels = scales::percent) + scale_fill_gradient_tableau(palette = "Blue", labels = scales::percent) + theme_void() + theme(legend.position = "right", plot.title = element_text(face = "bold")) + labs(title = "Vacine Uptake Among Eligible Residents", subtitle = "As of September 9th, 2021", caption = "Data: Texas Department of State Health Services", x = "Counties", y = "% Fully Vaccinated (Population 12+)", fill = "% Fully Vaccinated (12+)", color = "% Fully Vaccinated (12+)") ``` ] .panel2-draw-viz-2-auto[ <img src="index_files/figure-html/draw-viz-2_auto_11_output-1.png" width="504" /> ] <style> .panel1-draw-viz-2-auto { color: black; width: 38.6060606060606%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-draw-viz-2-auto { color: black; width: 59.3939393939394%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-draw-viz-2-auto { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> --- # 2. Map 2 .pull-left[ ```r # 2. Map of Vaccine Uptake All -------------------------------------------- tx_cnty_data %>% ggplot() + aes(fill = pct_vaccinated_all, color = pct_vaccinated_all) + geom_sf(size = 0.15) + scale_color_gradient_tableau(palette = "Blue", labels = scales::percent) + scale_fill_gradient_tableau(palette = "Blue", labels = scales::percent) + theme_void() + theme(legend.position = "right", plot.title = element_text(face = "bold")) + labs(title = "Vacine Uptake Among All Residents", subtitle = "As of September 9th, 2021", caption = "Data: Texas Department of State Health Services", x = "Counties", y = "% Fully Vaccinated (All)", fill = "% Fully Vaccinated (All)", color = "% Fully Vaccinated (All)") ``` ] .pull-right[ ] --- count: false # A step by step view .panel1-draw-viz-3-auto[ ```r # 2. Map of Vaccine Uptake All -------------------------------------------- *tx_cnty_data ``` ] .panel2-draw-viz-3-auto[ ``` Simple feature collection with 254 features and 27 fields Geometry type: MULTIPOLYGON Dimension: XY Bounding box: xmin: -106.6456 ymin: 25.83738 xmax: -93.50829 ymax: 36.5007 Geodetic CRS: NAD83 # A tibble: 254 × 28 county public_health_r… total_doses_all… vaccine_doses_a… people_vaccinat… <chr> <chr> <dbl> <chr> <chr> 1 Anderson 4/5N 17870 39286 22765 2 Andrews 9/10 6100 14009 7770 3 Angelina 4/5N 58100 65694 37278 4 Aransas 11 6840 25402 14309 5 Archer 2/3 3200 6928 3879 6 Armstrong 1 2100 1266 711 7 Atascosa 8 19000 42788 24286 8 Austin 6/5S 8700 25127 14708 9 Bailey 1 24135 4722 2730 10 Bandera 8 5100 17602 10067 # … with 244 more rows, and 23 more variables: people_fully_vaccinated <dbl>, # population_12 <dbl>, population_16 <chr>, population_65 <dbl>, # population_phase_1a_healthcare_workers <chr>, # population_phase_1a_long_term_care_residents <chr>, # population_16_64_any_medical_condition <chr>, # population_education_and_child_care_personnel <chr>, confirmed_cases <dbl>, # probable_cases <dbl>, fatalities <dbl>, prez_candidate_2020 <chr>, … ``` ] --- count: false # A step by step view .panel1-draw-viz-3-auto[ ```r # 2. Map of Vaccine Uptake All -------------------------------------------- tx_cnty_data %>% * ggplot() ``` ] .panel2-draw-viz-3-auto[ <img src="index_files/figure-html/draw-viz-3_auto_02_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-3-auto[ ```r # 2. Map of Vaccine Uptake All -------------------------------------------- tx_cnty_data %>% ggplot() + * aes(fill = pct_vaccinated_all, color = pct_vaccinated_all) ``` ] .panel2-draw-viz-3-auto[ <img src="index_files/figure-html/draw-viz-3_auto_03_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-3-auto[ ```r # 2. Map of Vaccine Uptake All -------------------------------------------- tx_cnty_data %>% ggplot() + aes(fill = pct_vaccinated_all, color = pct_vaccinated_all) + * geom_sf(size = 0.15) ``` ] .panel2-draw-viz-3-auto[ <img src="index_files/figure-html/draw-viz-3_auto_04_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-3-auto[ ```r # 2. Map of Vaccine Uptake All -------------------------------------------- tx_cnty_data %>% ggplot() + aes(fill = pct_vaccinated_all, color = pct_vaccinated_all) + geom_sf(size = 0.15) + * scale_color_gradient_tableau(palette = "Blue", labels = scales::percent) ``` ] .panel2-draw-viz-3-auto[ <img src="index_files/figure-html/draw-viz-3_auto_05_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-3-auto[ ```r # 2. Map of Vaccine Uptake All -------------------------------------------- tx_cnty_data %>% ggplot() + aes(fill = pct_vaccinated_all, color = pct_vaccinated_all) + geom_sf(size = 0.15) + scale_color_gradient_tableau(palette = "Blue", labels = scales::percent) + * scale_fill_gradient_tableau(palette = "Blue", labels = scales::percent) ``` ] .panel2-draw-viz-3-auto[ <img src="index_files/figure-html/draw-viz-3_auto_06_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-3-auto[ ```r # 2. Map of Vaccine Uptake All -------------------------------------------- tx_cnty_data %>% ggplot() + aes(fill = pct_vaccinated_all, color = pct_vaccinated_all) + geom_sf(size = 0.15) + scale_color_gradient_tableau(palette = "Blue", labels = scales::percent) + scale_fill_gradient_tableau(palette = "Blue", labels = scales::percent) + * theme_void() ``` ] .panel2-draw-viz-3-auto[ <img src="index_files/figure-html/draw-viz-3_auto_07_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-3-auto[ ```r # 2. Map of Vaccine Uptake All -------------------------------------------- tx_cnty_data %>% ggplot() + aes(fill = pct_vaccinated_all, color = pct_vaccinated_all) + geom_sf(size = 0.15) + scale_color_gradient_tableau(palette = "Blue", labels = scales::percent) + scale_fill_gradient_tableau(palette = "Blue", labels = scales::percent) + theme_void() + * theme(legend.position = "right", * plot.title = element_text(face = "bold")) ``` ] .panel2-draw-viz-3-auto[ <img src="index_files/figure-html/draw-viz-3_auto_08_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-3-auto[ ```r # 2. Map of Vaccine Uptake All -------------------------------------------- tx_cnty_data %>% ggplot() + aes(fill = pct_vaccinated_all, color = pct_vaccinated_all) + geom_sf(size = 0.15) + scale_color_gradient_tableau(palette = "Blue", labels = scales::percent) + scale_fill_gradient_tableau(palette = "Blue", labels = scales::percent) + theme_void() + theme(legend.position = "right", plot.title = element_text(face = "bold")) + * labs(title = "Vacine Uptake Among All Residents", * subtitle = "As of September 9th, 2021", * caption = "Data: Texas Department of State Health Services", * x = "Counties", * y = "% Fully Vaccinated (All)", * fill = "% Fully Vaccinated (All)", * color = "% Fully Vaccinated (All)") ``` ] .panel2-draw-viz-3-auto[ <img src="index_files/figure-html/draw-viz-3_auto_09_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-3-auto[ ```r # 2. Map of Vaccine Uptake All -------------------------------------------- tx_cnty_data %>% ggplot() + aes(fill = pct_vaccinated_all, color = pct_vaccinated_all) + geom_sf(size = 0.15) + scale_color_gradient_tableau(palette = "Blue", labels = scales::percent) + scale_fill_gradient_tableau(palette = "Blue", labels = scales::percent) + theme_void() + theme(legend.position = "right", plot.title = element_text(face = "bold")) + labs(title = "Vacine Uptake Among All Residents", subtitle = "As of September 9th, 2021", caption = "Data: Texas Department of State Health Services", x = "Counties", y = "% Fully Vaccinated (All)", fill = "% Fully Vaccinated (All)", color = "% Fully Vaccinated (All)") ``` ] .panel2-draw-viz-3-auto[ <img src="index_files/figure-html/draw-viz-3_auto_10_output-1.png" width="504" /> ] <style> .panel1-draw-viz-3-auto { color: black; width: 38.6060606060606%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-draw-viz-3-auto { color: black; width: 59.3939393939394%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-draw-viz-3-auto { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> --- class: code80 ## Our Data for Charts in Part 3 ```r # Pivot the Data Longways ------------------------------------------------- long_data <- tx_cnty_data |> as_tibble() |> mutate(cases_per1k = (confirmed_cases/tot_pop)*1000, deaths_per1k = (fatalities/tot_pop)*1000) |> pivot_longer(cols = c("cases_per1k","deaths_per1k","broadband", "labor_part_16","unemployment","w_health_insurance","share_above_65"), names_to = "comparison_features", values_to = "values") |> select(county, pct_vaccinated_eligible, comparison_features, values) head(long_data) ``` ``` # A tibble: 6 × 4 county pct_vaccinated_eligible comparison_features values <chr> <dbl> <chr> <dbl> 1 Anderson 0.373 cases_per1k 83.7 2 Anderson 0.373 deaths_per1k 2.46 3 Anderson 0.373 broadband 83.6 4 Anderson 0.373 labor_part_16 41.4 5 Anderson 0.373 unemployment 3.2 6 Anderson 0.373 w_health_insurance 85.5 ``` --- # 3. Scatterplot + Trend 1 .pull-left[ ```r # 1. Comparing Vaccine Uptake to Deaths Per 1k ----------------------------- long_data %>% filter(comparison_features=="deaths_per1k") %>% ggplot() + aes(y = pct_vaccinated_eligible, x = values, alpha = values) + geom_point() + geom_smooth(method="lm") + scale_y_continuous(labels = scales::percent) + scale_color_gradient_tableau(palette = "Blue", labels = scales::percent) + theme_minimal() + theme(legend.position = "none", plot.title = element_text(face = "bold")) + labs(title = "What May Be Driving Uptake?", subtitle = "As of September 9th, 2021", caption = "Data: Texas Department of State Health Services and US Census", x = "Deaths For Every 1,000 Persons", y = "% Fully Vaccinated (Population 12+)") ``` ] .pull-right[ ] --- count: false # A step by step view .panel1-draw-viz-4-auto[ ```r # 1. Comparing Vaccine Uptake to Deaths Per 1k ----------------------------- *long_data ``` ] .panel2-draw-viz-4-auto[ ``` # A tibble: 1,778 × 4 county pct_vaccinated_eligible comparison_features values <chr> <dbl> <chr> <dbl> 1 Anderson 0.373 cases_per1k 83.7 2 Anderson 0.373 deaths_per1k 2.46 3 Anderson 0.373 broadband 83.6 4 Anderson 0.373 labor_part_16 41.4 5 Anderson 0.373 unemployment 3.2 6 Anderson 0.373 w_health_insurance 85.5 7 Anderson 0.373 share_above_65 0.150 8 Andrews 0.439 cases_per1k 126. 9 Andrews 0.439 deaths_per1k 2.72 10 Andrews 0.439 broadband 91.6 # … with 1,768 more rows ``` ] --- count: false # A step by step view .panel1-draw-viz-4-auto[ ```r # 1. Comparing Vaccine Uptake to Deaths Per 1k ----------------------------- long_data %>% * filter(comparison_features=="deaths_per1k") ``` ] .panel2-draw-viz-4-auto[ ``` # A tibble: 254 × 4 county pct_vaccinated_eligible comparison_features values <chr> <dbl> <chr> <dbl> 1 Anderson 0.373 deaths_per1k 2.46 2 Andrews 0.439 deaths_per1k 2.72 3 Angelina 0.429 deaths_per1k 3.70 4 Aransas 0.576 deaths_per1k 2.13 5 Archer 0.461 deaths_per1k 1.49 6 Armstrong 0.375 deaths_per1k 3.55 7 Atascosa 0.480 deaths_per1k 3.45 8 Austin 0.485 deaths_per1k 1.51 9 Bailey 0.399 deaths_per1k 2.96 10 Bandera 0.421 deaths_per1k 1.71 # … with 244 more rows ``` ] --- count: false # A step by step view .panel1-draw-viz-4-auto[ ```r # 1. Comparing Vaccine Uptake to Deaths Per 1k ----------------------------- long_data %>% filter(comparison_features=="deaths_per1k") %>% * ggplot() ``` ] .panel2-draw-viz-4-auto[ <img src="index_files/figure-html/draw-viz-4_auto_03_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-4-auto[ ```r # 1. Comparing Vaccine Uptake to Deaths Per 1k ----------------------------- long_data %>% filter(comparison_features=="deaths_per1k") %>% ggplot() + * aes(y = pct_vaccinated_eligible, x = values, alpha = values) ``` ] .panel2-draw-viz-4-auto[ <img src="index_files/figure-html/draw-viz-4_auto_04_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-4-auto[ ```r # 1. Comparing Vaccine Uptake to Deaths Per 1k ----------------------------- long_data %>% filter(comparison_features=="deaths_per1k") %>% ggplot() + aes(y = pct_vaccinated_eligible, x = values, alpha = values) + * geom_point() ``` ] .panel2-draw-viz-4-auto[ <img src="index_files/figure-html/draw-viz-4_auto_05_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-4-auto[ ```r # 1. Comparing Vaccine Uptake to Deaths Per 1k ----------------------------- long_data %>% filter(comparison_features=="deaths_per1k") %>% ggplot() + aes(y = pct_vaccinated_eligible, x = values, alpha = values) + geom_point() + * geom_smooth(method="lm") ``` ] .panel2-draw-viz-4-auto[ <img src="index_files/figure-html/draw-viz-4_auto_06_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-4-auto[ ```r # 1. Comparing Vaccine Uptake to Deaths Per 1k ----------------------------- long_data %>% filter(comparison_features=="deaths_per1k") %>% ggplot() + aes(y = pct_vaccinated_eligible, x = values, alpha = values) + geom_point() + geom_smooth(method="lm") + * scale_y_continuous(labels = scales::percent) ``` ] .panel2-draw-viz-4-auto[ <img src="index_files/figure-html/draw-viz-4_auto_07_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-4-auto[ ```r # 1. Comparing Vaccine Uptake to Deaths Per 1k ----------------------------- long_data %>% filter(comparison_features=="deaths_per1k") %>% ggplot() + aes(y = pct_vaccinated_eligible, x = values, alpha = values) + geom_point() + geom_smooth(method="lm") + scale_y_continuous(labels = scales::percent) + * scale_color_gradient_tableau(palette = "Blue", labels = scales::percent) ``` ] .panel2-draw-viz-4-auto[ <img src="index_files/figure-html/draw-viz-4_auto_08_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-4-auto[ ```r # 1. Comparing Vaccine Uptake to Deaths Per 1k ----------------------------- long_data %>% filter(comparison_features=="deaths_per1k") %>% ggplot() + aes(y = pct_vaccinated_eligible, x = values, alpha = values) + geom_point() + geom_smooth(method="lm") + scale_y_continuous(labels = scales::percent) + scale_color_gradient_tableau(palette = "Blue", labels = scales::percent) + * theme_minimal() ``` ] .panel2-draw-viz-4-auto[ <img src="index_files/figure-html/draw-viz-4_auto_09_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-4-auto[ ```r # 1. Comparing Vaccine Uptake to Deaths Per 1k ----------------------------- long_data %>% filter(comparison_features=="deaths_per1k") %>% ggplot() + aes(y = pct_vaccinated_eligible, x = values, alpha = values) + geom_point() + geom_smooth(method="lm") + scale_y_continuous(labels = scales::percent) + scale_color_gradient_tableau(palette = "Blue", labels = scales::percent) + theme_minimal() + * theme(legend.position = "none", * plot.title = element_text(face = "bold")) ``` ] .panel2-draw-viz-4-auto[ <img src="index_files/figure-html/draw-viz-4_auto_10_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-4-auto[ ```r # 1. Comparing Vaccine Uptake to Deaths Per 1k ----------------------------- long_data %>% filter(comparison_features=="deaths_per1k") %>% ggplot() + aes(y = pct_vaccinated_eligible, x = values, alpha = values) + geom_point() + geom_smooth(method="lm") + scale_y_continuous(labels = scales::percent) + scale_color_gradient_tableau(palette = "Blue", labels = scales::percent) + theme_minimal() + theme(legend.position = "none", plot.title = element_text(face = "bold")) + * labs(title = "What May Be Driving Uptake?", * subtitle = "As of September 9th, 2021", * caption = "Data: Texas Department of State Health Services and US Census", * x = "Deaths For Every 1,000 Persons", * y = "% Fully Vaccinated (Population 12+)") ``` ] .panel2-draw-viz-4-auto[ <img src="index_files/figure-html/draw-viz-4_auto_11_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-4-auto[ ```r # 1. Comparing Vaccine Uptake to Deaths Per 1k ----------------------------- long_data %>% filter(comparison_features=="deaths_per1k") %>% ggplot() + aes(y = pct_vaccinated_eligible, x = values, alpha = values) + geom_point() + geom_smooth(method="lm") + scale_y_continuous(labels = scales::percent) + scale_color_gradient_tableau(palette = "Blue", labels = scales::percent) + theme_minimal() + theme(legend.position = "none", plot.title = element_text(face = "bold")) + labs(title = "What May Be Driving Uptake?", subtitle = "As of September 9th, 2021", caption = "Data: Texas Department of State Health Services and US Census", x = "Deaths For Every 1,000 Persons", y = "% Fully Vaccinated (Population 12+)") ``` ] .panel2-draw-viz-4-auto[ <img src="index_files/figure-html/draw-viz-4_auto_12_output-1.png" width="504" /> ] <style> .panel1-draw-viz-4-auto { color: black; width: 38.6060606060606%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-draw-viz-4-auto { color: black; width: 59.3939393939394%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-draw-viz-4-auto { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> --- # 3. Scatterplot + Trend 2 .pull-left[ ```r # 2. Comparing Vaccine Uptake to Cases Per 1k ----------------------------- long_data %>% filter(comparison_features=="cases_per1k") %>% ggplot() + aes(y = pct_vaccinated_eligible, x = values, alpha = values) + geom_point() + geom_smooth(method="lm") + scale_y_continuous(labels = scales::percent) + scale_color_gradient_tableau(palette = "Blue", labels = scales::percent) + theme_minimal() + theme(legend.position = "none", plot.title = element_text(face = "bold")) + labs(title = "What May Be Driving Uptake?", subtitle = "As of September 9th, 2021", caption = "Data: Texas Department of State Health Services and US Census", x = "Cases For Every 1,000 Persons", y = "% Fully Vaccinated (Population 12+)") ``` ] .pull-right[ ] --- count: false # A step by step view .panel1-draw-viz-5-auto[ ```r # 1. Comparing Vaccine Uptake to Deaths Per 1k ----------------------------- *long_data ``` ] .panel2-draw-viz-5-auto[ ``` # A tibble: 1,778 × 4 county pct_vaccinated_eligible comparison_features values <chr> <dbl> <chr> <dbl> 1 Anderson 0.373 cases_per1k 83.7 2 Anderson 0.373 deaths_per1k 2.46 3 Anderson 0.373 broadband 83.6 4 Anderson 0.373 labor_part_16 41.4 5 Anderson 0.373 unemployment 3.2 6 Anderson 0.373 w_health_insurance 85.5 7 Anderson 0.373 share_above_65 0.150 8 Andrews 0.439 cases_per1k 126. 9 Andrews 0.439 deaths_per1k 2.72 10 Andrews 0.439 broadband 91.6 # … with 1,768 more rows ``` ] --- count: false # A step by step view .panel1-draw-viz-5-auto[ ```r # 1. Comparing Vaccine Uptake to Deaths Per 1k ----------------------------- long_data %>% * filter(comparison_features=="deaths_per1k") ``` ] .panel2-draw-viz-5-auto[ ``` # A tibble: 254 × 4 county pct_vaccinated_eligible comparison_features values <chr> <dbl> <chr> <dbl> 1 Anderson 0.373 deaths_per1k 2.46 2 Andrews 0.439 deaths_per1k 2.72 3 Angelina 0.429 deaths_per1k 3.70 4 Aransas 0.576 deaths_per1k 2.13 5 Archer 0.461 deaths_per1k 1.49 6 Armstrong 0.375 deaths_per1k 3.55 7 Atascosa 0.480 deaths_per1k 3.45 8 Austin 0.485 deaths_per1k 1.51 9 Bailey 0.399 deaths_per1k 2.96 10 Bandera 0.421 deaths_per1k 1.71 # … with 244 more rows ``` ] --- count: false # A step by step view .panel1-draw-viz-5-auto[ ```r # 1. Comparing Vaccine Uptake to Deaths Per 1k ----------------------------- long_data %>% filter(comparison_features=="deaths_per1k") %>% * ggplot() ``` ] .panel2-draw-viz-5-auto[ <img src="index_files/figure-html/draw-viz-5_auto_03_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-5-auto[ ```r # 1. Comparing Vaccine Uptake to Deaths Per 1k ----------------------------- long_data %>% filter(comparison_features=="deaths_per1k") %>% ggplot() + * aes(y = pct_vaccinated_eligible, x = values, alpha = values) ``` ] .panel2-draw-viz-5-auto[ <img src="index_files/figure-html/draw-viz-5_auto_04_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-5-auto[ ```r # 1. Comparing Vaccine Uptake to Deaths Per 1k ----------------------------- long_data %>% filter(comparison_features=="deaths_per1k") %>% ggplot() + aes(y = pct_vaccinated_eligible, x = values, alpha = values) + * geom_point() ``` ] .panel2-draw-viz-5-auto[ <img src="index_files/figure-html/draw-viz-5_auto_05_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-5-auto[ ```r # 1. Comparing Vaccine Uptake to Deaths Per 1k ----------------------------- long_data %>% filter(comparison_features=="deaths_per1k") %>% ggplot() + aes(y = pct_vaccinated_eligible, x = values, alpha = values) + geom_point() + * geom_smooth(method="lm") ``` ] .panel2-draw-viz-5-auto[ <img src="index_files/figure-html/draw-viz-5_auto_06_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-5-auto[ ```r # 1. Comparing Vaccine Uptake to Deaths Per 1k ----------------------------- long_data %>% filter(comparison_features=="deaths_per1k") %>% ggplot() + aes(y = pct_vaccinated_eligible, x = values, alpha = values) + geom_point() + geom_smooth(method="lm") + * scale_y_continuous(labels = scales::percent) ``` ] .panel2-draw-viz-5-auto[ <img src="index_files/figure-html/draw-viz-5_auto_07_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-5-auto[ ```r # 1. Comparing Vaccine Uptake to Deaths Per 1k ----------------------------- long_data %>% filter(comparison_features=="deaths_per1k") %>% ggplot() + aes(y = pct_vaccinated_eligible, x = values, alpha = values) + geom_point() + geom_smooth(method="lm") + scale_y_continuous(labels = scales::percent) + * scale_color_gradient_tableau(palette = "Blue", labels = scales::percent) ``` ] .panel2-draw-viz-5-auto[ <img src="index_files/figure-html/draw-viz-5_auto_08_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-5-auto[ ```r # 1. Comparing Vaccine Uptake to Deaths Per 1k ----------------------------- long_data %>% filter(comparison_features=="deaths_per1k") %>% ggplot() + aes(y = pct_vaccinated_eligible, x = values, alpha = values) + geom_point() + geom_smooth(method="lm") + scale_y_continuous(labels = scales::percent) + scale_color_gradient_tableau(palette = "Blue", labels = scales::percent) + * theme_minimal() ``` ] .panel2-draw-viz-5-auto[ <img src="index_files/figure-html/draw-viz-5_auto_09_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-5-auto[ ```r # 1. Comparing Vaccine Uptake to Deaths Per 1k ----------------------------- long_data %>% filter(comparison_features=="deaths_per1k") %>% ggplot() + aes(y = pct_vaccinated_eligible, x = values, alpha = values) + geom_point() + geom_smooth(method="lm") + scale_y_continuous(labels = scales::percent) + scale_color_gradient_tableau(palette = "Blue", labels = scales::percent) + theme_minimal() + * theme(legend.position = "none", * plot.title = element_text(face = "bold")) ``` ] .panel2-draw-viz-5-auto[ <img src="index_files/figure-html/draw-viz-5_auto_10_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-5-auto[ ```r # 1. Comparing Vaccine Uptake to Deaths Per 1k ----------------------------- long_data %>% filter(comparison_features=="deaths_per1k") %>% ggplot() + aes(y = pct_vaccinated_eligible, x = values, alpha = values) + geom_point() + geom_smooth(method="lm") + scale_y_continuous(labels = scales::percent) + scale_color_gradient_tableau(palette = "Blue", labels = scales::percent) + theme_minimal() + theme(legend.position = "none", plot.title = element_text(face = "bold")) + * labs(title = "What May Be Driving Uptake?", * subtitle = "As of September 9th, 2021", * caption = "Data: Texas Department of State Health Services and US Census", * x = "Deaths For Every 1,000 Persons", * y = "% Fully Vaccinated (Population 12+)") ``` ] .panel2-draw-viz-5-auto[ <img src="index_files/figure-html/draw-viz-5_auto_11_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-5-auto[ ```r # 1. Comparing Vaccine Uptake to Deaths Per 1k ----------------------------- long_data %>% filter(comparison_features=="deaths_per1k") %>% ggplot() + aes(y = pct_vaccinated_eligible, x = values, alpha = values) + geom_point() + geom_smooth(method="lm") + scale_y_continuous(labels = scales::percent) + scale_color_gradient_tableau(palette = "Blue", labels = scales::percent) + theme_minimal() + theme(legend.position = "none", plot.title = element_text(face = "bold")) + labs(title = "What May Be Driving Uptake?", subtitle = "As of September 9th, 2021", caption = "Data: Texas Department of State Health Services and US Census", x = "Deaths For Every 1,000 Persons", y = "% Fully Vaccinated (Population 12+)") ``` ] .panel2-draw-viz-5-auto[ <img src="index_files/figure-html/draw-viz-5_auto_12_output-1.png" width="504" /> ] <style> .panel1-draw-viz-5-auto { color: black; width: 38.6060606060606%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-draw-viz-5-auto { color: black; width: 59.3939393939394%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-draw-viz-5-auto { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> --- # 3. Faceted Scatterplot .pull-left[ ```r # 3. Comparing Vaccine Uptake to Deaths Per 1k ----------------------------- long_data %>% ggplot() + aes(y = pct_vaccinated_eligible, x = values, alpha = values) + geom_point() + geom_smooth(method="lm") + facet_wrap(~comparison_features, scales = "free_x") + scale_y_continuous(labels = scales::percent) + scale_color_gradient_tableau(palette = "Blue", labels = scales::percent) + theme_minimal() + theme(legend.position = "none", plot.title = element_text(face = "bold")) + labs(title = "What May Be Driving Uptake?", subtitle = "As of September 9th, 2021", caption = "Data: Texas Department of State Health Services and US Census", x = "Share (%) of Feature", y = "% Fully Vaccinated (Population 12+)") ``` ] .pull-right[ ] --- count: false # A step by step view .panel1-draw-viz-6-auto[ ```r # 3. Comparing Vaccine Uptake to Deaths Per 1k ----------------------------- *long_data ``` ] .panel2-draw-viz-6-auto[ ``` # A tibble: 1,778 × 4 county pct_vaccinated_eligible comparison_features values <chr> <dbl> <chr> <dbl> 1 Anderson 0.373 cases_per1k 83.7 2 Anderson 0.373 deaths_per1k 2.46 3 Anderson 0.373 broadband 83.6 4 Anderson 0.373 labor_part_16 41.4 5 Anderson 0.373 unemployment 3.2 6 Anderson 0.373 w_health_insurance 85.5 7 Anderson 0.373 share_above_65 0.150 8 Andrews 0.439 cases_per1k 126. 9 Andrews 0.439 deaths_per1k 2.72 10 Andrews 0.439 broadband 91.6 # … with 1,768 more rows ``` ] --- count: false # A step by step view .panel1-draw-viz-6-auto[ ```r # 3. Comparing Vaccine Uptake to Deaths Per 1k ----------------------------- long_data %>% * ggplot() ``` ] .panel2-draw-viz-6-auto[ <img src="index_files/figure-html/draw-viz-6_auto_02_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-6-auto[ ```r # 3. Comparing Vaccine Uptake to Deaths Per 1k ----------------------------- long_data %>% ggplot() + * aes(y = pct_vaccinated_eligible, x = values, alpha = values) ``` ] .panel2-draw-viz-6-auto[ <img src="index_files/figure-html/draw-viz-6_auto_03_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-6-auto[ ```r # 3. Comparing Vaccine Uptake to Deaths Per 1k ----------------------------- long_data %>% ggplot() + aes(y = pct_vaccinated_eligible, x = values, alpha = values) + * geom_point() ``` ] .panel2-draw-viz-6-auto[ <img src="index_files/figure-html/draw-viz-6_auto_04_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-6-auto[ ```r # 3. Comparing Vaccine Uptake to Deaths Per 1k ----------------------------- long_data %>% ggplot() + aes(y = pct_vaccinated_eligible, x = values, alpha = values) + geom_point() + * geom_smooth(method="lm") ``` ] .panel2-draw-viz-6-auto[ <img src="index_files/figure-html/draw-viz-6_auto_05_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-6-auto[ ```r # 3. Comparing Vaccine Uptake to Deaths Per 1k ----------------------------- long_data %>% ggplot() + aes(y = pct_vaccinated_eligible, x = values, alpha = values) + geom_point() + geom_smooth(method="lm") + * facet_wrap(~comparison_features, scales = "free_x") ``` ] .panel2-draw-viz-6-auto[ <img src="index_files/figure-html/draw-viz-6_auto_06_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-6-auto[ ```r # 3. Comparing Vaccine Uptake to Deaths Per 1k ----------------------------- long_data %>% ggplot() + aes(y = pct_vaccinated_eligible, x = values, alpha = values) + geom_point() + geom_smooth(method="lm") + facet_wrap(~comparison_features, scales = "free_x") + * scale_y_continuous(labels = scales::percent) ``` ] .panel2-draw-viz-6-auto[ <img src="index_files/figure-html/draw-viz-6_auto_07_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-6-auto[ ```r # 3. Comparing Vaccine Uptake to Deaths Per 1k ----------------------------- long_data %>% ggplot() + aes(y = pct_vaccinated_eligible, x = values, alpha = values) + geom_point() + geom_smooth(method="lm") + facet_wrap(~comparison_features, scales = "free_x") + scale_y_continuous(labels = scales::percent) + * scale_color_gradient_tableau(palette = "Blue", labels = scales::percent) ``` ] .panel2-draw-viz-6-auto[ <img src="index_files/figure-html/draw-viz-6_auto_08_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-6-auto[ ```r # 3. Comparing Vaccine Uptake to Deaths Per 1k ----------------------------- long_data %>% ggplot() + aes(y = pct_vaccinated_eligible, x = values, alpha = values) + geom_point() + geom_smooth(method="lm") + facet_wrap(~comparison_features, scales = "free_x") + scale_y_continuous(labels = scales::percent) + scale_color_gradient_tableau(palette = "Blue", labels = scales::percent) + * theme_minimal() ``` ] .panel2-draw-viz-6-auto[ <img src="index_files/figure-html/draw-viz-6_auto_09_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-6-auto[ ```r # 3. Comparing Vaccine Uptake to Deaths Per 1k ----------------------------- long_data %>% ggplot() + aes(y = pct_vaccinated_eligible, x = values, alpha = values) + geom_point() + geom_smooth(method="lm") + facet_wrap(~comparison_features, scales = "free_x") + scale_y_continuous(labels = scales::percent) + scale_color_gradient_tableau(palette = "Blue", labels = scales::percent) + theme_minimal() + * theme(legend.position = "none", * plot.title = element_text(face = "bold")) ``` ] .panel2-draw-viz-6-auto[ <img src="index_files/figure-html/draw-viz-6_auto_10_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-6-auto[ ```r # 3. Comparing Vaccine Uptake to Deaths Per 1k ----------------------------- long_data %>% ggplot() + aes(y = pct_vaccinated_eligible, x = values, alpha = values) + geom_point() + geom_smooth(method="lm") + facet_wrap(~comparison_features, scales = "free_x") + scale_y_continuous(labels = scales::percent) + scale_color_gradient_tableau(palette = "Blue", labels = scales::percent) + theme_minimal() + theme(legend.position = "none", plot.title = element_text(face = "bold")) + * labs(title = "What May Be Driving Uptake?", * subtitle = "As of September 9th, 2021", * caption = "Data: Texas Department of State Health Services and US Census", * x = "Share (%) of Feature", * y = "% Fully Vaccinated (Population 12+)") ``` ] .panel2-draw-viz-6-auto[ <img src="index_files/figure-html/draw-viz-6_auto_11_output-1.png" width="504" /> ] --- count: false # A step by step view .panel1-draw-viz-6-auto[ ```r # 3. Comparing Vaccine Uptake to Deaths Per 1k ----------------------------- long_data %>% ggplot() + aes(y = pct_vaccinated_eligible, x = values, alpha = values) + geom_point() + geom_smooth(method="lm") + facet_wrap(~comparison_features, scales = "free_x") + scale_y_continuous(labels = scales::percent) + scale_color_gradient_tableau(palette = "Blue", labels = scales::percent) + theme_minimal() + theme(legend.position = "none", plot.title = element_text(face = "bold")) + labs(title = "What May Be Driving Uptake?", subtitle = "As of September 9th, 2021", caption = "Data: Texas Department of State Health Services and US Census", x = "Share (%) of Feature", y = "% Fully Vaccinated (Population 12+)") ``` ] .panel2-draw-viz-6-auto[ <img src="index_files/figure-html/draw-viz-6_auto_12_output-1.png" width="504" /> ] <style> .panel1-draw-viz-6-auto { color: black; width: 38.6060606060606%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-draw-viz-6-auto { color: black; width: 59.3939393939394%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-draw-viz-6-auto { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> --- class: journey-bg, section, left, middle, inverse # 📚 Resources 📚 ## Questions? lbjdata.org #### [#rstats hashtag](https://twitter.com/hashtag/rstats) on twitter #### [#ggplot2 hashtag](https://twitter.com/hashtag/ggplot2) on twitter #### [#TidyTuesday hashtag](https://twitter.com/hashtag/TidyTuesday) on twitter #### R For Data Science - [Online Book](https://r4ds.had.co.nz) | [Hard Copy](https://www.oreilly.com/library/view/r-for-data/9781491910382/) | [Slack Community](https://www.rfordatasci.com) --- class: journey-bg, section, center, middle, inverse # 🙏 Thank you 🙏 ## Questions? lbjdata.org ## Feedback: https://www.menti.com/f68w7ni8n5 ### 📧: matthew.worthington@austin.utexas.edu ### 🐦: @mrworthington