NYC Citibike Station Activity App

Yap Ching Loong Ian
2 Apr 2017

Background

  • Citibike is New York City's public bike sharing program
    • 600+ bike stations
    • 10,000+ bikes
    • Various riding schemes (single trip, multi-day pass, annual memberships)
  • Citibike provides data for each ride
    • Start/Stop time
    • Start/Stop stations
    • Trip durations
    • etc. etc.

Motivation

  • Visualization of bike station activity throughout the day
    • Only 1 day (12 Sep 2016) used
  • Statistics
    • Turnover (dockings + undockings)
      • Determine which bike stations have the highest performance
    • Net Outflow (undockings - dockings)
      • Determine which bike stations have the biggest need for re-balancing
  • Represent these metrics on a map
    • Use map elements to identify what makes these stations have outlier statistics (e.g. close to train stations/harbors)

App Details

  • Widgets
    • Drop-down list with times in intervals of 0.5hr (arrows to control)
    • Sliders to control the thresholds used for the markers used in the maps
    • Radio buttons to switch on/off the layers on the maps
  • Maps
    • 2 side-by-side maps
    • Left: Map for turnover
    • Right: Map for net outflow
  • Tabs
    • 1 tab for the maps
    • 1 tab for README

aa

Sample Statistics from dataframe

  • leaflet facility not available with R presenter
  • Only show some sample statistics from the processed data (saved in a dataframe)
startHrOfInterest <- 8.5 # Use 8:30 AM as an example

## Read bike station data
load("bike.RData")
# Loads 
# 1. flowCountList: a list of dataframes, each containing the statistics for each bike station ID for each period
# 2. bikeStationDf: Dataframe containing lat/lon, name and ID of the bike stations  

plotStationDf <- flowCountList[[as.character(startHrOfInterest)]] %>%
    dplyr::mutate(lat = bikeStationDf$station.latitude,
                  lon = bikeStationDf$station.longitude,
                  name = bikeStationDf$station.name)

arrange(plotStationDf, desc(turnover)) %>%
    head(4)
  station.id hour inCount outCount netOutflow turnover      lat       lon
1        519  8.5      33       53         20       86 40.75187 -73.97771
2        426  8.5      61       22        -39       83 40.71755 -74.01322
3        359  8.5      41       22        -19       63 40.75510 -73.97499
4       3263  8.5      21       40         19       61 40.72924 -73.99087
                    name
1  Pershing Square North
2  West St & Chambers St
3     E 47 St & Park Ave
4 Cooper Square & E 7 St