Climate Change Visualizing the Green New Deal with R Shiny

Posted on Jun 2, 2019

Project GitHub | LinkedIn:   Niki   Moritz   Hao-Wei   Matthew   Oren

The skills we demoed here can be learned through taking Data Science with Machine Learning bootcamp with NYC Data Science Academy.

New York has pressed on with environmental legislation while the nation dawdles - where and by whom will the impact be felt?

Shiny app | GitHub

As mentioned in my last post, effective and timely Climate legislation will be a key weapon in the battle to keep greenhouse gas emissions at sustainable levels and avoiding an ecological crisis. This will involve both supportive policies for new clean technologies and business models as well as measures to phase out the worst contributors to the problem.

New York City's Climate Mobilization Act is packed full of the latter, with hints of the former. Overall it is an attempt to keep the city in line with emissions targets set by the Paris International Climate agreement, particularly important for the city given its vulnerability to rising sea levels. Mayor Bill De Blasio's own Office of Sustainability said "Protecting New Yorkers from climate change is not optional.". You can read and hear more about the act on the front page of the app.

This visualization and its later iterations have value for any business in the city seeking to understand how they might be affected. Conversely, it also represents a way for energy companies to map possible opportunities. If they can better understand who will have to make significant energy efficiency upgrades as a result of the new laws, they can market products more efficiently.



The visualization is built using ShinyDashboard, with three tabs. The first gives an overview of New York State's current emissions situation, and some more information on what exactly is specified in the main components of the new act. The press release can be found here. The other two tabs go on to examine two specific bills.

The GoogleVis chart on this page gives indicative numbers for where New York State's emissions have come from, and where current plans might mean they come from in the future - the data for this comes from the State's Department of Environmental Conservation. Here I have included fossil fuel combustion in residential, commercial or industrial properties, as well as for electricity, all under the buildings category, while the industry category contains emissions as a result of industrial processes. The fundamental takeaway from this chart is that although progress has been made, if the state is to meet its own emissions reduction targets by 2030 it must do approximately 3 times as much work in 10 fewer years than it did from 1990 - 2015.


The second tab in the app examines the so-called "Dirty Buildings Bill", which requires buildings over 25,000 square feet to cut emissions by 40% by 2030, and 80% by 2050, by retrofitting new windows and insulation. The questions I really wanted to be able to answer with this tab were which areas, and what types of property, have the most to do when it comes to emissions reductions.

This tab uses building benchmarking data from NYC's Office of Sustainability. This was relatively easy to clean. Using the filters on the right hand side updates the GoogleVis scatter plot and ggplot histogram, allowing the user to examine distributions of building sizes and emissions. The outliers button is necessary to make the visualization clearer - the dataset is self-reported and there are clearly some errors. Finally, the infobox in the top right hand corner updates as the user filters to show the average annual emissions of the buildings selected.

There is a lot of exploring that can be done with this tab. A few general results are:

  • Offices, data centres, residence halls and hotels rank amongst the biggest greenhouse gas emitters, K-12 schools and distribution centres were surprise entries at the low end of the ranking
  • Manhattan has the highest average building emissions, and the highest average emissions intensity (emissions per square foot), while Brooklyn has the lowest of both of these metrics
  • Newer buildings generally have lower emissions, and more significantly, lower emissions intensities


The final tab in the project analyses a bill (which requires another vote) to convert all school buses to electric within 20 years, part of New York City's goal to switch all public buses to electric by 2040. Here the aim was to see which boroughs currently suffer from the worst pollution, and hence would benefit most from less exhaust fumes.

There are three layers to the interactive leaflet map. The yellow circles denote the positions of school bus garages, and their radius is proportional to the number of bus routes operating out of that garage. The brown circles similarly denote the positions at which pollutants are measured, their radius again being proportional to the total number of pollutants measured there. The choropleth of the boroughs shows the level of different pollutants associated with exhaust fumes (Carbon Monoxide, Hydrocarbons, Particulate Matter etc.). These can be selected on the right hand side and for some pollutants the type of sample also needs to be chosen.

This tab was harder to build. The data came from two separate sources; school bus information came from NYC Open Data whilst the air quality data came from the Environmental Protection Agency. The two unfortunately used different coordinate projections to locate the garages and pollutant measurements, respectively, so required some pre-processing before the pollutant data could be joined with the shapefiles. The borough shapefiles themselves came from the US Census Bureau.

A couple of conclusions from exploring this page:

  • There are large concentrations of school bus garages in areas of Queens, The Bronx and Brooklyn. Electrifying these will put large strain on the electricity networks in these areas. Effective local flexibility technologies like energy storage may be required to ease the transition.
  • Across the main vehicle pollutants, Queens seems to do the worst and hence has most to gain from more electric cars on the city's roads

Conclusions and further work

The first conclusion that should be highlighted here is that whilst the Climate Mobilization Act is a step in the right direction, it is still a small step compared to the scale of the challenge. Averting climate breakdown will require many more of these policies - this is the start of New York's climate change fight and not the end!

The app in its current form can be used to used to identify those areas, and in the case of the buildings data, those property segments that will be most affected by the new legislation. However, this only explores 2 of the 10 bills in the act, in the future I will expand this. My first target will be the bill investigating how to wean the city off fossil fuels. Looking at the data for wind/solar potential in the surrounding area and at sea could be very interesting. I would also like to introduce some way to tie the effects of the bills together, to try to get a concise overall picture of the impact of the package.

The buildings data unfortunately only lists buildings above 50,000 square feet, however as of next year this will be revised down to 25,000 square feet, which would make that data set even more relevant. Additionally, you may notice that Manhattan lacks a number of the pollutant measurement observations - a pollution data set with less geographically coarse measurements would be beneficial if it could be found.

About Author

Sam Collier

Sam Collier hails from across the pond where he earned both a First Class BSc and an MEng in Engineering Science from the University of Oxford, specializing in energy engineering. While in London, he did some work for...
View all posts by Sam Collier >

Related Articles

Leave a Comment

No comments found.

View Posts by Categories

Our Recent Popular Posts

View Posts by Tags

#python #trainwithnycdsa 2019 2020 Revenue 3-points agriculture air quality airbnb airline alcohol Alex Baransky algorithm alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus ames dataset ames housing dataset apartment rent API Application artist aws bank loans beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep boston safety Bundles cake recipe California Cancer Research capstone car price Career Career Day citibike classic cars classpass clustering Coding Course Demo Course Report covid 19 credit credit card crime frequency crops D3.js data data analysis Data Analyst data analytics data for tripadvisor reviews data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization database Deep Learning Demo Day Discount disney dplyr drug data e-commerce economy employee employee burnout employer networking environment feature engineering Finance Financial Data Science fitness studio Flask flight delay gbm Get Hired ggplot2 googleVis H20 Hadoop hallmark holiday movie happiness healthcare frauds higgs boson Hiring hiring partner events Hiring Partners hotels housing housing data housing predictions housing price hy-vee Income Industry Experts Injuries Instructor Blog Instructor Interview insurance italki Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter las vegas airport lasso regression Lead Data Scienctist Lead Data Scientist leaflet league linear regression Logistic Regression machine learning Maps market matplotlib Medical Research Meet the team meetup methal health miami beach movie music Napoli NBA netflix Networking neural network Neural networks New Courses NHL nlp NYC NYC Data Science nyc data science academy NYC Open Data nyc property NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time performance phoenix pollutants Portfolio Development precision measurement prediction Prework Programming public safety PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R R Data Analysis R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn seafood type Selenium sentiment analysis sentiment classification Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau teachers team team performance TensorFlow Testimonial tf-idf Top Data Science Bootcamp Top manufacturing companies Transfers tweets twitter videos visualization wallstreet wallstreetbets web scraping Weekend Course What to expect whiskey whiskeyadvocate wildfire word cloud word2vec XGBoost yelp youtube trending ZORI