Tidyverse to Army. How Copy? Over.

shiny nlp rvest tidyverse web scraping purrr

Helping the Army rename their Confederate-named bases with some help from R’s tidyverse, rvest, quanteda, and Shiny

Jeremy Allen https://jeremydata.com
02-21-2021

The Biden administration has given the Army three years to rename Confederate-named bases. I built this little web app that scrapes all Union general names from Wikipedia, then identifies the first letter of their last name and how many syllables are in that name. Click on a Confederate-named base and see all Union generals who match the first letter and number of syllables. I even found some Google fonts that are similar to 19-century fonts.

I use the rvest package to scrape the tables from Wikipedia. I count syllables with the nsyllable() function from the quanteda package. With purrr’s pmap() function I iterate over each Union general to make a Shiny UI element that formats each general’s name and ranks into a card format. All layout for the Shiny app is done with CSS Flexbox.

See the web app here.

All the code is on my GitHub.

Reuse

Text and figures are licensed under Creative Commons Attribution CC BY 4.0. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".

Citation

For attribution, please cite this work as

Allen (2021, Feb. 21). jeremydata: Tidyverse to Army. How Copy? Over.. Retrieved from https://jeremydata.com/posts/2021-02-21-tidyverse-to-army-how-copy-over/

BibTeX citation

@misc{allen2021tidyverse,
  author = {Allen, Jeremy},
  title = {jeremydata: Tidyverse to Army. How Copy? Over.},
  url = {https://jeremydata.com/posts/2021-02-21-tidyverse-to-army-how-copy-over/},
  year = {2021}
}