R

Map Census Data With R

This talk was presented on May 30th, 2019 at Code For Pittsburgh. Before we dive in, this presentation assumes that the user has basic familiarity with tidyverse, mainly dplyr.

Premier League 538 SPI Ratings

538’s Soccer Power Index (SPI) rates the quality of soccer teams from a variety of leagues around the world. In this post I’ll use gganimate to animate team SPI over the past 3 seasons.

Animating Growth of Allegheny County

In this post I will show how to create animated graphs that illustrate the increase in buildings in Allegheny County. One caveat about the data: it only includes parcels that were sold at some point.

Modeling Pittsburgh House Sales Linear

In this post I will be modeling house (land parcel) sales in Pittsburgh. The data is from the WPRDC’s Parcels n’at dashboard. The goal is to use linear modeling to predict the sale price of a house using features of the house and the property.

Actblue Interstate Political Campaign Donations

ActBlue is an online service that allows people to make donations to the political campaigns of Democractic candidates across the country. This post uses graph theory to analyze how political donations moved across states.

Networking USL Club Similarity With Euclidean Distance

Euclidean distance is a simple way to measure the distance between two points. It can also be used to measure how similar two sports teams are, given a set of variables.

Clustering Allegheny County Census Tracts With PCA and k-means

In this post I will use the census API discussed in the last post to cluster the Allegheny County census tracts using PCA and k-means. Setup library(tidyverse) library(tidycensus) library(tigris) library(sf) library(broom) library(ggfortify) library(viridis) library(janitor) library(scales) library(ggthemes) options(tigris_use_cache = TRUE) theme_set(theme_minimal()) census_vars <- load_variables(2010, "sf1", cache = TRUE) Census tracts are small geographic areas analogous to local neighborhoods.

USL in the 538 Global Club Soccer Rankings

This post was originally run with data from August 2018. 538 does not provide historical rankings, so I had to rerun the code with September 2020 data when I migrated my blog.

Exploring Allegheny County With Census Data

This post explores Allegheny County and Pennsylvania through census data. I use the tidycensus and sf packages to collect data from the census API and draw maps with the data.

Allegheny County Overdose Data

Opiate addiction and overdose have become a major problem in American society. The life expectancy in the U.S. has decreased for the past 2 years, and deaths from drug overdoses rose 21% from 2016 to 2017.