Skip to main content

jbrnbrg

Tag: visualization

Mapping NYC's 23K Trashcan Locations

The New York City Department of Sanitation (DSNY) - the largest department of its kind in the world - is responsible for the city’s garbage-collection operation. One component of this operation is the regular emptying of 23,000+ street-level trashcans - or as they call them: “litter baskets.” DSNY offers up their geo-coded litter-basket inventory - refreshed monthly - through the NYC OpenData portal and in today’s post I’ll walk through how to create an interactive, 3D fly-over map of these litter-basket locations with the help of Mapbox’s Mapbox GL JS API in R.

A Quick Look at Datawrapper's Tooltips

I recently came across Datawrapper while checking out New York City’s COVID-19 Vaccines page and - going on appearance alone - the charts, tables, and maps (hosted & served by Datawrapper) appear attractive, responsive, and have a cohesive look. As I am always interested in checking out new visualization tools, I took the Datawrapper API (and GUI) for a spin and created the below example as a proof of concept - you can hover-and-click on the map points to read additional information:

Forecasting National Park Visits

Following full vaccination, folks have begun venturing outdoors for the first time in long while - myself included! In support of outdoor-activity planning, today’s post is going to cover forecasting national park visits for each month of 2021. Since there are 63 National Parks in the US across 30 states and two territories, I will employ the sweep package to address the scale of forecasts to be made/reviewed all while keeping the data in a tidy format.

A Median Chocolate Chip Cookie Recipe & Styling ggplot Text

Today’s post is a recipe for median chocolate chip cookies that’s also a ggplot chart with colored-coded text in the subtitle. The recipe is based on summary stats from 200+ recipes from eightportions.com’s “Recipe Box” data where the recipe title contains the text: “chocolate chip cookies” and the colored text was made possible with ggtext. Tl;dr: The recipe: I will briefly cover the source data, preparation, and one way to add colored text and unicode symbols ◍ to ggplot texts like caption, subtitle, title, etc.

JavaScript in RStudio with r2d3

RStudio, an IDE for R, has made tons of improvements over the past 5 years and one of them is the ability to run non-R code (including the output from said non-R code) inline, within an RMarkdown document. In light of this functionality, today’s post will run through an example of how to run JavaScript - specifically, d3.js, a JS library for “manipulating documents based on data” - within RStudio using the library r2d3.

StreetEasy Neighborhood Rentals & CrossTalk

At this point it’s pretty well-established that the pandemic has had a tremendous impact on human life around the world and particularly within New York City’s five boroughs. At the time of this post, over 10% of the USA’s 209K+ deaths have come from NYC alone (23,852). The death-toll from the pandemic is staggering on its own - and continues to shock in its reach - but the addition of the shutdown (and continued restrictions - even in Phase 4 of the reopening) has had a compounding effect on all aspects of socioeconomic activity in the city.

NYPD Article 221 Arrests and Summonses

Today’s post builds upon some of the work from a previous post to include historic and year-to-date Arrest and Summonses counts by NYPD precinct. The aim is to use visualization (plotly, primarily) to explore the impact of policy changes on racial equity over time. Data Historic and Year-to-Date information from NYC’s OpenData API for NYPD Arrests and Summonses related to Article 221 of the New York Penal Law (PL221) from 2009-07-01 through 2019-06-30 (10-years of data).

Translating Tract-Level ACS Data to NYPD Precincts

In this posts I’m going to demonstrate how to get NYC census data at the tract level to estimate census data at the NYPD-precinct level. There are 77 NYPD precincts serving five boroughs of NYC and each precinct contains multiple census tracts. To get the census-level demographics on a per-precinct level, I’ll need a way to aggregate the tract data into precincts - let’s get started!

Choropleths with 311 Data Using in R

In today’s post I build upon the last post to demonstrate the use of the tmap package to make a choropleth map in R. I also include instructions on how to use the sf library to obtain the block-level census tract IDs included in the tidycensus ACS data for the State Plane coordinates within the NYC 311 data. If you’re new to making maps, it’s important that you recognize the differences between geographic coordinate and projected coordinate systems.

An Interactive Dash App for NYC Gas Consumption and Cost

I had some time this past weekend so I created a Dash App to deploy on Heroku as part of this website portfolio. I’ve created visualizations in plotly using both R and Python but I wanted to show off my Dash skills with a relatively simple application that I could walk through in a short amount of time. Here’s a screen-cap preview: Screen capture of Gas App hosted on Heroku

A Quick Tableau Dashboard for NYC EMS Data

The Tableau dashboard software is a truly powerful visualization tool. Using their Public Verison, I was able to create a very powerful dashboard visual in about an hour. The paid version at the time of this post is $70/month but if you don’t mind saving to their public site, the free option is just fine. Don’t worry if you’re just starting out: Tableau offers users the option of hiding visuals and data from view if you’re not ready go public.

NYC EMS Flexdashboard with Plotly

I’ve recently deployed a flexdashboard on shinyapps.io that allows a user to compare the EMS call counts and dispatch/response times between boroughs of NYC. You can check out the application here. EMS Flexdashboard Screencap The data used by the dashboard is read directly from the NYC Open data API and it covers each call for all 5 boroughs from 2013-2017 inclusive. The data contains 7.2M individual observations (emergency calls into the system) with a variety of features including call type, severity level, borough, and zip code.

Plotly Scattermapbox with R and Python

I recently tried out plot.ly’s open source graphing library and found it to be challenging but worth the effort. Challenging, in that the documentation has some gaps but worth it in that the features of the standard plots are responsive (via .js) and feature-rich right out of the box. I tried out both python and R versions of plot.ly and I found the R version to be the most straight-forward to use and deploy via shinyapps.

Binary Response and GGally

If I am working on data with a binary response, I like to use the GGally package for its ggpairs function. It provides a way to look at a lot of different data types at the same time but the setup and customization can be a little daunting. In this example, which leverages this crime data, I demonstrate how ggpairs can be used to reveal a lot of information in a single figure.