Last updated: 2022-04-18

Checks: 7 0

Knit directory: myTidyTuesday/

This reproducible R Markdown analysis was created with workflowr (version 1.7.0). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

The command set.seed(20210907) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.

The results in this page were generated with repository version 260b95d. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Ignored files:
    Ignored:    .Rhistory
    Ignored:    .Rproj.user/
    Ignored:    catboost_info/
    Ignored:    data/.Rhistory
    Ignored:    data/CNHI_Excel_Chart.xlsx
    Ignored:    data/Chicago.rds
    Ignored:    data/CommunityTreemap.jpeg
    Ignored:    data/Community_Roles.jpeg
    Ignored:    data/SeriesReport-20220414171148_6c3b18.xlsx
    Ignored:    data/Weekly_Chicago_IL_Regular_Reformulated_Retail_Gasoline_Prices.csv
    Ignored:    data/YammerDigitalDataScienceMembership.xlsx
    Ignored:    data/YammerMemberPage.rds
    Ignored:    data/YammerMembers.rds
    Ignored:    data/acs_poverty.rds
    Ignored:    data/austinHomeValue.rds
    Ignored:    data/austinHomeValue2.rds
    Ignored:    data/df.rds
    Ignored:    data/fmhpi.rds
    Ignored:    data/grainstocks.rds
    Ignored:    data/hike_data.rds
    Ignored:    data/nber_rs.rmd
    Ignored:    data/netflixTitles2.rds
    Ignored:    data/raw_weather.RData
    Ignored:    data/us_states.rds
    Ignored:    data/us_states_hexgrid.geojson
    Ignored:    data/weatherstats_toronto_daily.csv

Untracked files:
    Untracked:  analysis/2022_03_25_TimeSeriesShowcase.Rmd
    Untracked:  code/YammerReach.R
    Untracked:  code/chicago.R
    Untracked:  code/googleCompute.R
    Untracked:  code/work list batch targets.R
    Untracked:  environment.yml

Unstaged changes:
    Deleted:    analysis/2022_02_11_tabular_playground.Rmd
    Deleted:    analysis/2022_04_18.qmd
    Modified:   code/_common.R

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


These are the previous versions of the repository in which changes were made to the R Markdown (analysis/2022_04_18.Rmd) and HTML (docs/2022_04_18.html) files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view the files as they were in that past version.

File Version Author Date Message
Rmd 260b95d opus1993 2022-04-18 Supreme Court

The #30DayChartChallenge is running once again over on Twitter with lots of inspirational data visualization content. One of the pros to follow is Tanya Shapiro. She poses a question here that prompted my short post today.

I think ggiraph is my new favorite #RStats library. Easy way to make your ggplots interactive. "Interactified" last week's pictogram of Supreme Court Justices. 🧑‍⚖️

Anyone have any a work-around for creating tooltip hovers for geom_image?https://t.co/6JdRTFItBN

— Tanya Shapiro (@tanya_shapiro) April 15, 2022

I had attempted to work on her challenge with the new Quarto document framework, github pages, and the workflowr site management system. More on what I discovered at the end. First, let’s load the open source packages:

suppressPackageStartupMessages({
library(rvest)
library(tidyverse)
library(ggimage)
library(ggiraph)
})

Her graphic depicts seated justices through the history of the United States Supreme Court. The visual includes Justice Ketanji Brown Jackson, who was recently confirmed on April 7th, 2022. Once sworn in, Jackson will be the 116th justice and the first Black woman to sit on the Supreme Court.

Emojis are used to denote gender and race of each justice. Colored points are based on nominating president party affiliation (e.g. red for Republican).

Let’s make a link to the data source at wikipedia:

url <- 'https://en.wikipedia.org/wiki/List_of_justices_of_the_Supreme_Court_of_the_United_States'

Scraping the page html table from the wikipedia page is easy with rvest:

sc_justices_raw <- url |> 
  read_html() |> 
  html_elements(".wikitable") |> 
  html_table(trim = TRUE, fill = TRUE) |> 
  pluck(1) 

names(sc_justices_raw) <-
  c(
    "index",
    "blank",
    "justice",
    "state",
    "position",
    "succeeded",
    "confirmed",
    "tenured",
    "length",
    "nominated_by"
  )

sc_justices_raw <- sc_justices_raw |> 
  mutate(id = row_number()) |> 
  head(-1)  # remove the last row of the dataframe

We need to clean the dataset a little to parse the dates and categorize justices.

justices <- sc_justices_raw |> 
  #some justices were promoted to chief justice later, get distinct justices
  distinct(justice,
           .keep_all = TRUE) |> 
  select(-index, -blank) |> 
  separate(justice, into = c("name", "born_died"), sep = "\\(") |> 
  mutate(
    index = row_number(),
    born_died = str_replace(born_died, "\\)", ""),
    position = str_replace(position, "\\s*\\[[^\\)]+\\]", ""),
    position = case_when(
      position == "ChiefJustice" ~ "Chief Justice",
      position == "AssociateJustice" ~ "Associate Justice"
    ),
    confirmed = str_replace(confirmed, "\\([^()]*\\)", ""),
    confirmed = str_replace(confirmed, "\\s*\\[[^\\)]+\\]", ""),
    confirmed = as.Date(confirmed, '%B %d, %Y'),
    demo = case_when(
      name %in% c('Thurgood Marshall', 'Clarence Thomas') ~ 'black_male',
      name %in% c(
        "Sandra Day O'Connor",
        "Ruth Bader Ginsburg",
        "Elena Kagan",
        "Amy Coney Barrett"
      ) ~ 'white_female',
      name == 'Sonia Sotomayor' ~ 'hispanic_female',
      TRUE ~ 'white_male'
    )
  ) 

Similarly, getting a list of presidents with party affiliation is easy with rvest and wikipedia:

pres_url <- 'https://en.wikipedia.org/wiki/List_of_presidents_of_the_United_States'

#scrape president data
pres_raw <- pres_url |>
  read_html() |>
  html_elements(".wikitable") |>
  html_table(trim = TRUE, fill = TRUE) |>
  pluck(1) |> 
  head(-1)
  
  
names(pres_raw) <-
  c(
    "index",
    "portrait",
    "name_birth_death",
    "term",
    "party_misc",
    "party",
    "election",
    "vp"
  )

As above, the presidents data needs a little bit of cleaning for party affiliation.

presidents <- pres_raw |> 
  select(name_birth_death, party) |> 
  separate(name_birth_death, into = c("name","birth_death"), sep = "\\(") |> 
  mutate(party = str_replace(party, "\\s*\\[[^\\)]+\\]",""),
         name = str_replace(name, "\\s*\\[[^\\)]+\\]","")
         ) |> 
  distinct(name,party) |> 
  mutate(index = row_number()) |> 
  distinct(index,
           .keep_all = TRUE) |> 
  select(-index)

A this point, we join presidents to justices and add Justice Jackson.

justices <- justices |>
  left_join(presidents, by = c("nominated_by" = "name")) |>
  bind_rows(
    data.frame(
      name = "Ketanji Brown Jackson",
      born_died = NA,
      state = NA,
      position = "Associate Justice",
      succeeded = "Breyer",
      confirmed = as.Date('2022-04-07'),
      tenured = NA,
      length = NA,
      nominated_by = "Joe Biden",
      id = NA,
      index = 116,
      demo = "black_female",
      party = "Democratic"
    )
    
  )

To build the plot, position variables will be needed to give each justice a tile on a grid.

justices <- justices |> 
  mutate(y = (index - 1) %/%  10,       # truncated division wihtout remainder
         x = (index - 1) %% 10)         # the remainder

Credit for the trick to get png images for emojis goes to Emil Hvitfeldt, here

white_male_icon <- 'https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/120/apple/325/man-judge-light-skin-tone_1f468-1f3fb-200d-2696-fe0f.png'
black_male_icon <- 'https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/120/apple/325/man-judge-medium-dark-skin-tone_1f468-1f3fe-200d-2696-fe0f.png'
white_female_icon_2 <- 'https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/120/apple/325/woman-judge-medium-light-skin-tone_1f469-1f3fc-200d-2696-fe0f.png'
white_female_icon <- 'https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/120/apple/325/woman-judge-light-skin-tone_1f469-1f3fb-200d-2696-fe0f.png'
hispanic_female_icon <- 'https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/120/apple/325/woman-judge-medium-skin-tone_1f469-1f3fd-200d-2696-fe0f.png'
black_female_icon <- 'https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/120/apple/325/woman-judge-medium-dark-skin-tone_1f469-1f3fe-200d-2696-fe0f.png'

Last, lets create the new variable in the justices data frame to match up with the icon html information.

justices <- justices |>
  mutate(
    icon = case_when(
      name == "Sandra Day O'Connor" ~ white_female_icon_2,
      demo == "white_male" ~ white_male_icon,
      demo == "white_female" ~ white_female_icon,
      demo == "black_male" ~ black_male_icon,
      demo == "black_female" ~ black_female_icon,
      demo == "hispanic_female" ~ hispanic_female_icon
    ),
    party_group = as_factor(case_when(
      party %in% c(
        "Federalist",
        "Whig",
        "Unaffiliated",
        "National Union",
        "National Republican"
      ) ~ "Other",
      TRUE ~ party
    )),
    party_group = fct_relevel(party_group,
                              c("Democratic-Republican",
                                "Democratic",
                                "Republican",
                                "Other"))
  ) 

Building out the ggplot is simple. Shapiro uses a Google font in her work that I have not downloaded. I’ve added a geom_point_interactive() tooltip from the ggiraph package.

gg <- ggplot(data = justices, 
       mapping = aes(x = x + 1, y = y + 1)) +
  geom_point(size = 12, aes(color = party_group), alpha = 0.9) +
  scale_color_manual(
    values = c("#EBB027", "#266DD3", "#CC3333", "grey"),
    guide = guide_legend(
      title.position = "top",
      title.hjust = 0.5,
      override.aes = list(size = 3)
    )
  ) +
  geom_image(aes(image = icon)) +
  geom_text(aes(label = index), vjust = 4.8, size = 2) +
  geom_point_interactive(aes(tooltip = glue::glue(
    "{ name } \n { tenured } \n Nominated by { nominated_by }")
    ),
    alpha = 0.002) +
  scale_y_reverse(limits = c(12.5, 1)) +
  labs(
    title = "United States Supreme Court Justices",
    subtitle = "Emoji Portraits of all 116 Justices",
    color = "NOMINATING PRESIDENT PARTY AFFILIATION",
    caption = "Data from Wikipedia | Original Chart by @tanya_shapiro"
  ) +
  theme(
    legend.position = "top",
    legend.title = element_text(size = 8),
    legend.key = element_rect(fill = NA),
    plot.margin = margin(
      r = 20,
      l = 20,
      t = 10,
      b = 5
    ),
    plot.title = element_text(hjust = 0.5, face = "bold"),
    plot.subtitle = element_text(hjust = 0.5),
    plot.background = element_blank(),
    panel.background = element_blank(),
    axis.ticks = element_blank(),
    axis.text = element_blank(),
    axis.title = element_blank()
  ) 

girafe(ggobj = gg,
       width_svg = 6,
       height_svg = 8)

Thank you to


sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22000)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] ggiraph_0.8.2   ggimage_0.3.0   forcats_0.5.1   stringr_1.4.0  
 [5] dplyr_1.0.8     purrr_0.3.4     readr_2.1.2     tidyr_1.2.0    
 [9] tibble_3.1.6    ggplot2_3.3.5   tidyverse_1.3.1 rvest_1.0.2    
[13] workflowr_1.7.0

loaded via a namespace (and not attached):
 [1] httr_1.4.2         sass_0.4.1         jsonlite_1.8.0     modelr_0.1.8      
 [5] bslib_0.3.1        assertthat_0.2.1   getPass_0.2-2      yulab.utils_0.0.4 
 [9] selectr_0.4-2      cellranger_1.1.0   yaml_2.3.5         pillar_1.7.0      
[13] backports_1.4.1    glue_1.6.2         uuid_1.0-4         digest_0.6.29     
[17] promises_1.2.0.1   colorspace_2.0-3   ggfun_0.0.6        htmltools_0.5.2   
[21] httpuv_1.6.5       pkgconfig_2.0.3    tweetrmd_0.0.9     broom_0.8.0       
[25] haven_2.4.3        magick_2.7.3       scales_1.2.0       processx_3.5.3    
[29] ggplotify_0.1.0    whisker_0.4        later_1.3.0        tzdb_0.3.0        
[33] git2r_0.30.1       farver_2.1.0       generics_0.1.2     ellipsis_0.3.2    
[37] withr_2.5.0        cli_3.2.0          magrittr_2.0.3     crayon_1.5.1      
[41] readxl_1.4.0       evaluate_0.15      ps_1.6.0           fs_1.5.2          
[45] fansi_1.0.3        xml2_1.3.3         tools_4.1.2        hms_1.1.1         
[49] lifecycle_1.0.1    munsell_0.5.0      reprex_2.0.1       callr_3.7.0       
[53] compiler_4.1.2     jquerylib_0.1.4    systemfonts_1.0.4  gridGraphics_0.5-1
[57] rlang_1.0.2        grid_4.1.2         rstudioapi_0.13    htmlwidgets_1.5.4 
[61] labeling_0.4.2     rmarkdown_2.13     gtable_0.3.0       DBI_1.1.2         
[65] curl_4.3.2         R6_2.5.1           lubridate_1.8.0    knitr_1.38        
[69] fastmap_1.1.0      utf8_1.2.2         rprojroot_2.0.3    stringi_1.7.6     
[73] Rcpp_1.0.8.3       vctrs_0.4.0        dbplyr_2.1.1       tidyselect_1.1.2  
[77] xfun_0.30         
LS0tDQp0aXRsZTogIlN1cHJlbWUgQ291cnQgUGljdG9ncmFtIg0KYXV0aG9yOiAiSmltIEdydW1hbiINCmRhdGU6ICJBcHJpbCAxOCwgMjAyMiINCm91dHB1dDoNCiAgd29ya2Zsb3dyOjp3Zmxvd19odG1sOg0KICAgIHRvYzogbm8NCiAgICBjb2RlX2ZvbGRpbmc6IGhpZGUNCiAgICBjb2RlX2Rvd25sb2FkOiB0cnVlDQogICAgZGZfcHJpbnQ6IHBhZ2VkDQplZGl0b3Jfb3B0aW9uczoNCiAgY2h1bmtfb3V0cHV0X3R5cGU6IGNvbnNvbGUNCi0tLQ0KDQpUaGUgIzMwRGF5Q2hhcnRDaGFsbGVuZ2UgaXMgcnVubmluZyBvbmNlIGFnYWluIG92ZXIgb24gVHdpdHRlciB3aXRoIGxvdHMgb2YgaW5zcGlyYXRpb25hbCBkYXRhIHZpc3VhbGl6YXRpb24gY29udGVudC4gT25lIG9mIHRoZSBwcm9zIHRvIGZvbGxvdyBpcyBbVGFueWEgU2hhcGlyb10oaHR0cHM6Ly90d2l0dGVyLmNvbS90YW55YV9zaGFwaXJvKS4gU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