My first attempt at a TidyTuesday! It’s been a very busy week, and I’m working to engage in all the important events around me. I’m so glad that this dataset was chosen, but unfortunately, I didn’t have a lot of time to spend working on it.
I’ve provided a few quick visualizations. But most importantly, I’ve set up a workflow and GitHub repo & website. I’m excited to work on more TidyTuesdays all summer!
firsts <- readr::read_csv("firsts.csv")
science <- readr::read_csv("science.csv")
firsts
## # A tibble: 479 x 5
## year accomplishment person gender category
## <dbl> <chr> <chr> <chr> <chr>
## 1 1738 First free African-Ameri… Gracia Real de Sa… African-A… Social & …
## 2 1760 First known African-Amer… Jupiter Hammon (p… Female Af… Arts & En…
## 3 1768 First known African-Amer… Wentworth Cheswel… African-A… Social & …
## 4 1773 First known African-Amer… Phillis Wheatley … Female Af… Arts & En…
## 5 1773 First separate African-A… Silver Bluff Bapt… African-A… Religion
## 6 1775 First African-American t… Prince Hall African-A… Social & …
## 7 1778 First African-American U… the 1st Rhode Isl… African-A… Military
## 8 1783 First African-American t… James Derham, who… African-A… Education…
## 9 1785 First African-American o… Rev. Lemuel Hayne… African-A… Religion
## 10 1792 First major African-Amer… 3,000 Black Loyal… African-A… Social & …
## # … with 469 more rows
science
## # A tibble: 120 x 7
## name birth death occupation_s inventions_accompl… references links
## <chr> <dbl> <dbl> <chr> <chr> <chr> <chr>
## 1 Amos,… 1918 2003 Microbiologist First African-Amer… 6, https:…
## 2 Alcor… 1940 NA Physicist; in… Invented a method … 7,8, https:…
## 3 Andre… 1930 1998 Mathematician Put forth the Andr… 9, https:…
## 4 Alexa… 1888 1958 Civil engineer Responsible for th… <NA> https:…
## 5 Baile… 1825 1918 Inventor Folding bed 10, https:…
## 6 Ball,… 1892 1916 Chemist Extracted chaulmoo… 11, https:…
## 7 Banne… 1731 1806 Almanac autho… Constructed wooden… 12, https:…
## 8 Banya… 1947 NA Mathematician Work on diffeomorp… 13, https:…
## 9 Bashe… 1957 NA Inventor; ent… First African-Amer… 14, https:…
## 10 Bath,… 1942 2019 Ophthalmologi… First African-Amer… 15,16,17, https:…
## # … with 110 more rows
firsts <- firsts %>%
mutate(sex = ifelse(str_sub(gender, 1,6) == "Female", "female", "male"),
century = 100*floor(year/100))
firsts
## # A tibble: 479 x 7
## year accomplishment person gender category sex century
## <dbl> <chr> <chr> <chr> <chr> <chr> <dbl>
## 1 1738 First free African-… Gracia Real… African… Social &… male 1700
## 2 1760 First known African… Jupiter Ham… Female … Arts & E… fema… 1700
## 3 1768 First known African… Wentworth C… African… Social &… male 1700
## 4 1773 First known African… Phillis Whe… Female … Arts & E… fema… 1700
## 5 1773 First separate Afri… Silver Bluf… African… Religion male 1700
## 6 1775 First African-Ameri… Prince Hall African… Social &… male 1700
## 7 1778 First African-Ameri… the 1st Rho… African… Military male 1700
## 8 1783 First African-Ameri… James Derha… African… Educatio… male 1700
## 9 1785 First African-Ameri… Rev. Lemuel… African… Religion male 1700
## 10 1792 First major African… 3,000 Black… African… Social &… male 1700
## # … with 469 more rows
ggplot(firsts) +
geom_bar(aes(x = sex, fill = category), position = "fill") +
scale_fill_brewer(palette = "Spectral") +
facet_grid(.~century)
science %>% select(occupation_s) %>%
table()
## .
## Acoustician; inventor
## 1
## Almanac author; surveyor; farmer
## 1
## Anthropologist
## 1
## Astronomer
## 1
## Astrophysicist
## 1
## Atmospheric scientist
## 1
## Automotive engineer
## 1
## Bacteriologist; epidemiologist
## 1
## Biochemist[citation needed]
## 1
## Bioengineer
## 1
## Biophysicist
## 1
## Botanical researcher
## 1
## Cancer research and surgeon
## 1
## Chemical engineer
## 1
## Chemist
## 8
## Chemist; educator
## 1
## Civil engineer
## 1
## Computer engineer
## 2
## Computer scientist
## 6
## Dentist; professor
## 1
## Economist; social scientist
## 1
## Economist; social scientist; statistician
## 1
## Electrical Engineer; inventor
## 1
## Electrician; construction; international businessman; and aviation pioneer
## 1
## Engineer
## 1
## Engineer; inventor
## 2
## Environmental chemist
## 1
## Evolutionary biologist
## 1
## Farmer; carpenter; blacksmith; railroad worker; businessman; inventor
## 1
## Gastroenterologist
## 1
## Geneticist
## 1
## Geochemist
## 1
## Inventor
## 20
## Inventor; blacksmith; abolitionist
## 1
## Inventor; draftsman; expert witness
## 1
## Inventor; engineer
## 1
## Inventor; entrepreneur; architect; industrial designer
## 1
## Inventor; entrepreneur; professional consultant
## 1
## Inventor[citation needed]
## 1
## Linguist
## 2
## Mathematician
## 5
## Mathematician; engineer; nuclear scientist
## 1
## Mathematician; statistician
## 2
## Medical researcher
## 1
## Microbiologist
## 1
## Neurobiologist
## 1
## Neurosurgeon
## 1
## Nuclear engineer
## 1
## Nurse
## 1
## Ophthalmologist
## 1
## Orthodontist
## 1
## Pediatric neurosurgeon
## 1
## Physical therapist; inventor
## 1
## Physician
## 1
## Physicist
## 4
## Physicist; educator
## 1
## Physicist; inventor
## 1
## Professor; International Finance; inventor
## 1
## Psychologist
## 2
## Psychologist; social scientist
## 1
## Research engineer
## 1
## Researcher; chemist (electronics/specialty chemicals)
## 1
## Roboticist
## 1
## Scientist
## 1
## Scientist and researcher
## 1
## Scientist; fluoride chemist
## 1
## Surgeon
## 2
## Surgeon; biomedical engineer[citation needed]
## 1
## Surgical technician
## 1
## Theoretical physicist
## 1
## Transplant surgeon; researcher
## 1
## Woods Hole Marine Biology Institute biologist
## 1
## Zoologist
## 2
## ZoologistexplorerAnthropologist
## 1
science2 <- science %>%
dplyr::mutate(occup2 = tolower(occupation_s)) %>%
filter(!is.na(occupation_s)) %>%
dplyr::mutate(occup2 = dplyr::case_when(
str_detect(occup2, "bio") ~ "bio",
str_detect(occup2, "zoo") ~ "bio",
str_detect(occup2, "engin") ~ "engin",
str_detect(occup2, "math") ~ "math",
str_detect(occup2, "computer scientist") ~ "cs",
str_detect(occup2, "astro") ~ "astro",
str_detect(occup2, "invent") ~ "invent",
str_detect(occup2, "farmer") ~ "farmer",
str_detect(occup2, "chem") ~ "chem",
str_detect(occup2, "surg") ~ "medical",
str_detect(occup2, "physician") ~ "medical",
str_detect(occup2, "nurse") ~ "medical",
str_detect(occup2, "psych") ~ "psych",
str_detect(occup2, "physic") ~ "physics",
str_detect(occup2, "econ") ~ "econ",
str_detect(occup2, "business") ~ "econ",
str_detect(occup2, "medic") ~ "medical",
str_detect(occup2, "ophtha") ~ "medical",
str_detect(occup2, "ortho") ~"medical",
str_detect(occup2, "epi") ~ "medical",
str_detect(occup2, "dentist") ~ "medical",
str_detect(occup2, "genet") ~ "bio",
str_detect(occup2, "botan") ~ "bio",
str_detect(occup2, "scien") ~ "scientist",
str_detect(occup2, "anth") ~ "scientist",
str_detect(occup2, "robot") ~ "scientist",
TRUE ~ as.character(occup2)))
science2 %>% select(occup2) %>% table()
## .
## astro bio chem cs econ engin farmer
## 3 13 13 6 3 13 1
## invent linguist math medical physics psych scientist
## 30 2 7 14 6 3 5
science2 <- science2 %>%
mutate(end = ifelse(is.na(death), 2020, death)) %>%
mutate(living = ifelse(is.na(death), "alive", "dead")) %>%
mutate(occupation = occup2) %>%
separate(name, c("last_name", "first_name"), remove = FALSE) %>%
mutate(scientist = paste(last_name,", ",str_sub(first_name, 1, 1), sep=""))
## Warning: Expected 2 pieces. Additional pieces discarded in 49 rows [2, 3,
## 5, 6, 12, 14, 23, 26, 27, 30, 31, 35, 36, 38, 41, 43, 45, 46, 47, 48, ...].
ncolor <- length(table(science2$occupation))
occpalette <- unname(randomcoloR::distinctColorPalette(ncolor))
science2 %>%
filter(!is.na(birth)) %>%
ggplot() +
geom_segment(aes(y = reorder(scientist, birth), yend = scientist, x = birth,
xend = end,
color = occupation),
size = .5) +
labs(title = "Lifetimes of Notable African Americans", x = "years living", y = "") +
scale_color_manual(values = occpalette) +
theme(axis.text.y = element_text(size = 3, color="navy"))