NYC Data Science Academy| Blog
Bootcamps
Lifetime Job Support Available Financing Available
Bootcamps
Data Science with Machine Learning Flagship ๐Ÿ† Data Analytics Bootcamp Artificial Intelligence Bootcamp New Release ๐ŸŽ‰
Free Lesson
Intro to Data Science New Release ๐ŸŽ‰
Find Inspiration
Find Alumni with Similar Background
Job Outlook
Occupational Outlook Graduate Outcomes Must See ๐Ÿ”ฅ
Alumni
Success Stories Testimonials Alumni Directory Alumni Exclusive Study Program
Courses
View Bundled Courses
Financing Available
Bootcamp Prep Popular ๐Ÿ”ฅ Data Science Mastery Data Science Launchpad with Python View AI Courses Generative AI for Everyone New ๐ŸŽ‰ Generative AI for Finance New ๐ŸŽ‰ Generative AI for Marketing New ๐ŸŽ‰
Bundle Up
Learn More and Save More
Combination of data science courses.
View Data Science Courses
Beginner
Introductory Python
Intermediate
Data Science Python: Data Analysis and Visualization Popular ๐Ÿ”ฅ Data Science R: Data Analysis and Visualization
Advanced
Data Science Python: Machine Learning Popular ๐Ÿ”ฅ Data Science R: Machine Learning Designing and Implementing Production MLOps New ๐ŸŽ‰ Natural Language Processing for Production (NLP) New ๐ŸŽ‰
Find Inspiration
Get Course Recommendation Must Try ๐Ÿ’Ž An Ultimate Guide to Become a Data Scientist
For Companies
For Companies
Corporate Offerings Hiring Partners Candidate Portfolio Hire Our Graduates
Students Work
Students Work
All Posts Capstone Data Visualization Machine Learning Python Projects R Projects
Tutorials
About
About
About Us Accreditation Contact Us Join Us FAQ Webinars Subscription An Ultimate Guide to
Become a Data Scientist
    Login
NYC Data Science Acedemy
Bootcamps
Courses
Students Work
About
Bootcamps
Bootcamps
Data Science with Machine Learning Flagship
Data Analytics Bootcamp
Artificial Intelligence Bootcamp New Release ๐ŸŽ‰
Free Lessons
Intro to Data Science New Release ๐ŸŽ‰
Find Inspiration
Find Alumni with Similar Background
Job Outlook
Occupational Outlook
Graduate Outcomes Must See ๐Ÿ”ฅ
Alumni
Success Stories
Testimonials
Alumni Directory
Alumni Exclusive Study Program
Courses
Bundles
financing available
View All Bundles
Bootcamp Prep
Data Science Mastery
Data Science Launchpad with Python NEW!
View AI Courses
Generative AI for Everyone
Generative AI for Finance
Generative AI for Marketing
View Data Science Courses
View All Professional Development Courses
Beginner
Introductory Python
Intermediate
Python: Data Analysis and Visualization
R: Data Analysis and Visualization
Advanced
Python: Machine Learning
R: Machine Learning
Designing and Implementing Production MLOps
Natural Language Processing for Production (NLP)
For Companies
Corporate Offerings
Hiring Partners
Candidate Portfolio
Hire Our Graduates
Students Work
All Posts
Capstone
Data Visualization
Machine Learning
Python Projects
R Projects
About
Accreditation
About Us
Contact Us
Join Us
FAQ
Webinars
Subscription
An Ultimate Guide to Become a Data Scientist
Tutorials
Data Analytics
  • Learn Pandas
  • Learn NumPy
  • Learn SciPy
  • Learn Matplotlib
Machine Learning
  • Boosting
  • Random Forest
  • Linear Regression
  • Decision Tree
  • PCA
Interview by Companies
  • JPMC
  • Google
  • Facebook
Artificial Intelligence
  • Learn Generative AI
  • Learn ChatGPT-3.5
  • Learn ChatGPT-4
  • Learn Google Bard
Coding
  • Learn Python
  • Learn SQL
  • Learn MySQL
  • Learn NoSQL
  • Learn PySpark
  • Learn PyTorch
Interview Questions
  • Python Hard
  • R Easy
  • R Hard
  • SQL Easy
  • SQL Hard
  • Python Easy
Data Science Blog > R Shiny > Data Study on Bay Area Bike Share

Data Study on Bay Area Bike Share

Stefan Heinz
Posted on Feb 13, 2017
The skills the author demoed here can be learned through taking Data Science with Machine Learning bootcamp with NYC Data Science Academy.

Introduction

This post is about the first of the four projects we are supposed to deliver at the NYC Data Science Academy Data Science Bootcamp program. The requirements were:

For this project, you are not only expected to lead your audience through data insights
gleaned from visual representations, but also required to build an interactive Shiny
application that can create and modify such graphics on-the-fly.

You must find the balance of the correct level of interactivity and simplicity that allows an outside user to
both understand your points and also uncover their own insights without getting
distracted by excess accoutrements.

I chose to work on data provided by Bay Area Bike Share. This is a "bike sharing system with 700 bikes and 70 stations across the [Bay Area] region [...]. Intended to provide Bay Area residents and visitors with an additional transportation option for getting around the region, the Bay Area Bike Share is fun, easy, and affordable."


Source Data

I sourced the data from the Bay Area Bike Share Open Data page and downloaded the datasets for year 2 (Sep 2014 - Aug 2015) and year 3 (Sep 2015 - Aug 2016) in order to create a new dataset containing all the data for the year 2015. The following data was used in this project:

Stations

station_id name lat long dockcount landmark installation

Trips

Trips ID Duration Start Date Start Station Start Terminal End Date End Station End Terminal Bike No Subscriber Type ZIP Code

Weather

ZIP Date Max. Temperature F Mean Temperature F Min. Temperature F Cloud Cover

The data was in very good quality so that I had to do almost no cleaning.

For the temperature there were a few missing values for one day where there was no data recorded. Because this data was not too important for the overall application but I did not want to have gaps in the data, I used the zoo library to copy values that already existed for the a variable to the empty cells of the same variable. All of the other data was basically 100% complete so that this part could be indeed kept to a minimum. All the data was converted from CSV to the for R optimized RDS data format to save space and improve the loading speed in R.

 

Data Aggregates

Having established the data source to use for my project and acquainted myself with it, I created various aggregations per dataset (cf. Source Data) to be able to calculate various measurements on different groupings of the data. They are:

Based on Trips

  • routes: Grouping of trips per route, i.e. Start Station to End Station, with various measurements, such as total amount of trips taken on that route,  durations (min, max, avg) of these trips, ..., for both the cases that direction does and does not matter, i.e. Start - End != End - Start and Start - End = End - Start.
  • bikes: Grouping of trips per bike number with various measurements, such as total amount of trips taken on that bike or the number of days each bike was in use.
  • stations by start/end hour/date: Usage of stations as start or end point of a trip by hour of day or day of year in total amount of trips.
  • zipStartByDate: Total amount of trips per day of year the trip was started on and ZIP of the station the trip was started at.
  • cust: Total amount and total duration of trips per subscriber type, i.e. Subscriber (annual or 30-day member) or Customer (24-hour or 3-day member).

Based on Stations

  • docks: Grouping of stations per city (landmark) with the measurements stationCount and dockCount.

Based on Weather

  • weatherTrips: Weather per day of year and ZIP in combination with the amount of trips from zipStartByDate.

Data Visualization in Shiny

The visualization of the data had to be done in Shiny, which is a "web application framework for R [to] turn [...] analyses into interactive web applications". Furthermore, I used Shiny Dashboard to create a management dashboard-esque application.

Start

As you can see on the image below, on the menu on the left I created various items to thematically group the charts and maps I was going to implement. These are Stations, Trips, Bikes, Customers, and Weather (cf. Data Aggregates). I will go on to explain them in detail.

Data Study on Bay Area Bike Share

Start

Stations

This tab delivers various insights into the data on station level. It starts with showing a map where all the stations are shown at their actual position. The overview tab then shows the user in which city how many stations and docks are positioned.

Data Study on Bay Area Bike Share

Stations

For each of these stations, detailed statistics about their usage either throughout the year, i.e. per date, or throughout the day, i.e. on a 24h clock, can be found. The stations can also be compared in terms of the aforementioned characteristics.

Trips

The next item on the menu is the trips tab. This allows access to detailed statistics about all the trips taken on the Bay Area Bike Share network. It begins with the map the user already knows from the stations tab, but this time they are able to print routes on the map, for both the cases that direction does and does not matter. The default threshold for routes to display is set to 1,000, i.e. there must have been at least 1,000 trips on a route for it to be drawn on the map. The user can change this setting, and the line width corresponds to the amount of trips taken on a certain route.

Data Study on Bay Area Bike Share

Trips

On the next tab, the sankey chart gives a good overview of the most important routes and stations of the system by indicating by means of line width and node width from left to right - start to end - which trips were popular in the year 2015. Finally, the table shows various statistics for each of the routes.

Bikes

In terms of bikes, the user is presented with a histogram that shows bike usage in three metrics - total amount of usage, total duration of usage and median duration of usage. It becomes immediately clear that some bikes are heavily used while others seem to be barely touched at all.

Bikes

Bikes

On the next tab, the timeline  displays for each bike exactly how many days it was in operation in 2015, i.e. during which time period it was used for trips. The dual slider on top lets the user filter the range of operation days which the timeline should show.

Customers

The content of this tab does not react to any user input. It basically shows a bunch of value boxes that compare the two customer types, Subscriber and Customer.

Customers

Customers

Weather

This tab allows the user to take a look at the temperatures in F, C, and the cloud cover per day of the year for each of the five cities and compare it to the trips started on that day on any of the stations in each city.

Weather

Weather

Conclusion

In terms of actual findings within the data, nothing was too surprising:

  • Some routes are more popular than others
  • In cities with more stations there is a higher frequency of trips taken on the network
  • It seems to be the case that trips to and from Caltrain stations are more popular than others
  • Longer trips are taken by ad-hoc customers - tourists (?) -  than subscribers, who are probably mostly commuters
  • A bit astonishing: not all bikes seem to be in use the whole year. Some were only on the streets for a few days while others were used throughout the whole year.
  • Temperature and cloud cover do not seem to affect the amount of trips taken at all. Although there was data about on which days it rained or where there even was a thunderstorm, it was not taken into consideration as it was only listed per day and broken not down to hours of the day.

This dataset, although only consisting of a few files, makes for a good showcase about the possibilities of a Shiny application. Basic capabilities - info and values boxes, and ggplot charts - were used as well as more advanced features, such as Google Charts and Leaflet Maps. It was a valuable experience to get an overall look at R this way - loading and working with data, creating various plots in different engines, and combining it all together into a single dashboard.

As for Shiny in particular, this project helped me very much in understanding how to exactly use the different files ui.R, server.R, global.R and helpers.R, and how to create an app out of all these building blocks.

As stated above, code and data can be found on GitHub, while the app itself is online at shinyapps.io.

About Author

Stefan Heinz

Stefan received his Bachelor's degree in Logistics from Heilbronn University in Germany, including a one year stopover in Hong Kong. He then went on to graduate cum laude from Maastricht University's School of Business and Economics in the...
View all posts by Stefan Heinz >

Related Articles

Data Visualization
Data Insights on US Gun Violence
R
Vision Zero: NYC Traffic Collision Prevention Plan
R
U.S. Cancer Research & R Shiny Application
R
Climate Change Visualizing the Green New Deal with R Shiny
Data Visualization
Data Science For Good: Identify which schools needs help

Leave a Comment

Cancel reply

You must be logged in to post a comment.

Graphic Design Graduate School Nyc | Try new and inovative ideas for Grapic Design February 24, 2017
[โ€ฆ] A Graphic Look at Bay Area Bike Share โ€“ He then went on to graduate cum laude from Maastricht Universityโ€™s School of Business and Economics in the Netherlands โ€ฆ Originally โ€ฆ [โ€ฆ]
A Graphic Look at Bay Area Bike Share โ€“ Mubashir Qasim February 14, 2017
[โ€ฆ] article was first published on R โ€“ NYC Data Science Academy Blog, and kindly contributed to [โ€ฆ]
A Graphic Look at Bay Area Bike Share - Use-R!Use-R! February 13, 2017
[โ€ฆ] article was first published on R โ€“ NYC Data Science Academy Blog, and kindly contributed to [โ€ฆ]
Zweites Projekt: Ausprobieren! โ€“ Stefan in NYC February 13, 2017
[โ€ฆ] ist dann auch der technische Blogpost zum ersten Projekt [โ€ฆ]

View Posts by Categories

All Posts 2399 posts
AI 7 posts
AI Agent 2 posts
AI-based hotel recommendation 1 posts
AIForGood 1 posts
Alumni 60 posts
Animated Maps 1 posts
APIs 41 posts
Artificial Intelligence 2 posts
Artificial Intelligence 2 posts
AWS 13 posts
Banking 1 posts
Big Data 50 posts
Branch Analysis 1 posts
Capstone 206 posts
Career Education 7 posts
CLIP 1 posts
Community 72 posts
Congestion Zone 1 posts
Content Recommendation 1 posts
Cosine SImilarity 1 posts
Data Analysis 5 posts
Data Engineering 1 posts
Data Engineering 3 posts
Data Science 7 posts
Data Science News and Sharing 73 posts
Data Visualization 324 posts
Events 5 posts
Featured 37 posts
Function calling 1 posts
FutureTech 1 posts
Generative AI 5 posts
Hadoop 13 posts
Image Classification 1 posts
Innovation 2 posts
Kmeans Cluster 1 posts
LLM 6 posts
Machine Learning 364 posts
Marketing 1 posts
Meetup 144 posts
MLOPs 1 posts
Model Deployment 1 posts
Nagamas69 1 posts
NLP 1 posts
OpenAI 5 posts
OpenNYC Data 1 posts
pySpark 1 posts
Python 16 posts
Python 458 posts
Python data analysis 4 posts
Python Shiny 2 posts
R 404 posts
R Data Analysis 1 posts
R Shiny 560 posts
R Visualization 445 posts
RAG 1 posts
RoBERTa 1 posts
semantic rearch 2 posts
Spark 17 posts
SQL 1 posts
Streamlit 2 posts
Student Works 1687 posts
Tableau 12 posts
TensorFlow 3 posts
Traffic 1 posts
User Preference Modeling 1 posts
Vector database 2 posts
Web Scraping 483 posts
wukong138 1 posts

Our Recent Popular Posts

AI 4 AI: ChatGPT Unifies My Blog Posts
by Vinod Chugani
Dec 18, 2022
Meet Your Machine Learning Mentors: Kyle Gallatin
by Vivian Zhang
Nov 4, 2020
NICU Admissions and CCHD: Predicting Based on Data Analysis
by Paul Lee, Aron Berke, Bee Kim, Bettina Meier and Ira Villar
Jan 7, 2020

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 ChatGPT 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 football 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 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

NYC Data Science Academy

NYC Data Science Academy teaches data science, trains companies and their employees to better profit from data, excels at big data project consulting, and connects trained Data Scientists to our industry.

NYC Data Science Academy is licensed by New York State Education Department.

Get detailed curriculum information about our
amazing bootcamp!

Please enter a valid email address
Sign up completed. Thank you!

Offerings

  • HOME
  • DATA SCIENCE BOOTCAMP
  • ONLINE DATA SCIENCE BOOTCAMP
  • Professional Development Courses
  • CORPORATE OFFERINGS
  • HIRING PARTNERS
  • About

  • About Us
  • Alumni
  • Blog
  • FAQ
  • Contact Us
  • Refund Policy
  • Join Us
  • SOCIAL MEDIA

    ยฉ 2025 NYC Data Science Academy
    All rights reserved. | Site Map
    Privacy Policy | Terms of Service
    Bootcamp Application