So many visualization platforms are available these days, and to my cap I place yet another feather: Flourish.
For starters, at least.
Here is an example – a simple stacked bar – easily created from a free account:
As a fan of R, I am a little leery about creating graphics without having a piece of code that generates (and documents) the chart you see here. We’ll see how this goes. But I can easily update this chart at the Flourish website and the changes will appear here, as the embed link remains the same.
I grabbed these data from a rather robust wikipedia page (and spot checked some of the entries). After scraping the many tables from wikipedia, I cleaned and munged them into a matrix with a row for each year and then a column for each administration. This structure is what Flouish needs to make a stacked bar – different from R.
So, that goes something like this:
library(rvest)
disj<-read_html("https://en.wikipedia.org/wiki/List_of_current_United_States_district_judges")
tbls <- html_nodes(disj, "table") # html_nodes acts as a CSS selector
tbls_ls <- tbls %>%
html_table(fill = TRUE) # html_table parses tables
district<-tbls_ls[2:107] # some subsetting
district<-bind_rows(district, .id = "iden") # mash the list into a df
district<-district[ ,c(1,3:10)] # yay!
I repeated these steps to scrape the appellate judges, then stacked the two dataframes into usjudges
. Finally, some matrix flipping and wrote to CSV for uploading to Flourish:
temp<-usjudges %>% dplyr::select(Born,Appoint2)
x<-temp %>% group_by(Born) %>% count(Appoint2)
x2<-x %>% pivot_wider(values_from = n,
names_from = Appoint2)
write.csv(x2,"C:/path/path/judgesF.csv") # for flourish.com