Data Study on New York City Street Trees in Shiny

Posted on May 15, 2016
The skills the author demoed here can be learned through taking Data Science with Machine Learning bootcamp with NYC Data Science Academy.
Contributed by Belinda Kanpetch. She is currently in the NYC Data Science Academy 12 week full time Data Science Bootcamp program taking place between April 11th to July 1st, 2016. This post is based on her second class project - Shiny (due on the 4th week of the program).

New York City Street Trees

For our second project, building a Shiny app, I chose to continue with the subject addressed in our first project, Exploratory Visualization, because I intuitively felt there was more to be learned though an interface like Shiny. Also, as an urban designer I am fascinated by ways in which coding and data analytics can inform the design process. For this project I will be expand beyond the scope of Manhattan to include all 5 boroughs.

The Data Set

The dataset was downloaded from NYC Open Data Portal and was collected as part of TreeCount!2015, a street tree census maintained by the NYC Department of Parks and Recreation.  The firs census was collected in 1995 and has been conducted by trained volunteers every 10 years since its inception.

Similar to the Exploratory Visualization project, the data had to be cleaned and parsed. There were missing values for species, community districts, tree condition and geospatial information required for mapping. Observations with missing values in the species, community district, or tree condition fields were not dropped from the analysis but grouped and represented accordingly. Observations with missing latitude or longitude were removed only in the dataset used to create the map because Leaflet would not map any points after it encountered its first observation with missing geospatial data.

Designing and deploying the app

When designing this app, I imagined it being a tool for fellow design colleagues who rely on visualization of spatial relationships to inform design. In addition, the capability of exploring the dataset itself was also important. Play with the app here or see the code on github.

Having the data accessible through an interactive interface like Shiny allowed for a more fluid analysis of the data.  I could quickly and easily produce graphs visualizing different parameters and then compare them to the map for spatial analysis.

Inspecting the graph of tree count per community district showed some CDs in the Bronx had little to no trees.  Toggling back to the map revealed that this made sense since those CDs with no street trees were predominantly parkland.

 Data Study on New York City Street Trees in Shiny

Data Study on New York City Street Trees in Shiny

During the Exploratory Visualization project it was unclear why there are so many trees with missing values for species. After deploying the Shiny app, it became clear that missing values for species was due to the tree condition (#6 and 7) in which they were categorized as Stumps or Empty Tree Pits.  This makes sense as it is difficult to identify a tree if it is missing or just a stump.

Data Study on New York City Street Trees in Shiny

It was also helpful to have the ability to normalize the data at the check of a box.  In the example below we see the tree count per community district by tree condition and then the same data normalized.

CD_COND CD_COND_NORM

Conclusions and next steps

This was a fun project to design and produce.  Although there are aspects that need to be worked out, it is very clear how powerful Shiny can be in communicating ideas through accessible data visualization. Mapping and visualization are integral in the urban design field yet a lot of designers lack the access to robust software like GIS.  But with a little coding experience, Shiny makes its possible to visualize the data which informs the design process.

Aspects I'd like to work on:

  • Map legend. Because there are 168 species, choosing a color palette has been challenging
  • Graph legend to be reactive to what is being graphed
  • Tree species decoded to common names
  • Community Districts decoded to include Borough names

About Author

Belinda Kanpetch

Belinda hails from the Bayou City, where she earned her Bachelors of Architecture from the University of Houston. Drawn to the bright lights and energy of the city, she relocated to New York to attend Columbia University at...
View all posts by Belinda Kanpetch >

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