New York City Street Trees in Shiny

Belinda Kanpetch
Posted on May 15, 2016

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 Dataset

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.

 CD_COND

BX_no_trees

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.

SPCS_COND

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 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 airbnb Alex Baransky alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus API Application artist aws 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 Bundles California Cancer Research capstone Career Career Day citibike clustering Coding Course Demo Course Report D3.js data Data Analyst data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization Deep Learning Demo Day Discount dplyr employer networking feature engineering Finance Financial Data Science Flask gbm Get Hired ggplot2 googleVis Hadoop higgs boson Hiring hiring partner events Hiring Partners Industry Experts Instructor Blog Instructor Interview Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter lasso regression Lead Data Scienctist Lead Data Scientist leaflet linear regression Logistic Regression machine learning Maps matplotlib Medical Research Meet the team meetup Networking neural network Neural networks New Courses nlp NYC NYC Data Science nyc data science academy NYC Open Data NYCDSA NYCDSA Alumni Online Online Bootcamp Open Data painter pandas Part-time Portfolio Development prediction Prework Programming PwC python python machine learning python scrapy python web scraping python webscraping Python Workshop R 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 Selenium sentiment analysis Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau team TensorFlow Testimonial tf-idf Top Data Science Bootcamp twitter visualization web scraping Weekend Course What to expect word cloud word2vec XGBoost yelp