Citi Bike Riders in Different Ages – the Potential of Target Advertising

[This article was first published on R – NYC Data Science Academy Blog, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.


As more and more people enjoy healthy and efficient lifestyles, riding bikes to work is recognized as a better commuting choice than driving or walking. The Citi Bike program launched in 2013 with 332 stations and 6000 bikes. It now owns 706 stations and 12,000 bikes, making it be the largest sharing bike program in the U.S. In 2016 Citi Bike riders took an average 38,491 rides per day, a number that nearly doubled in 2017. While Citi Bike has a large number of customers and subscribers,  it can win over more by advertising to car drivers, bus riders or pedestrians. With a view of the potential market for CitiBike services, I would like to explore the data and try to seek a way to better know the crowd.

As we known different age group would have different needs and desires, so I am going to use age as the main factor to analyze when and where to place advertisements to different people. To that end,  I built an app based on R Shiny and use ggplot2, plotly, and leaflet to visualize my finding. This is the link to github and my Shiny app is also available here.


I downloaded the 2016 January to December Trip Data in Jersey City from Citi Bike System Data.

The original data structure was as follows:

  • Trip Duration (seconds)
  • Start Time and Date
  • Stop Time and Date
  • Start Station Name
  • End Station Name
  • Station ID
  • Station Lat/Long
  • Bike ID
  • User Type (Customer = 24-hour pass or 3-day pass user; Subscriber = Annual Member)
  • Gender (Zero=unknown; 1=male; 2=female)
  • Year of Birth

I used dyplr, tidyr, and data table to clear up and manipulate the data set. Based on the data, I divided people into six age groups: 15-25, 25-35, 35-45, 45-55, 55-65, and 65-75.


In this analysis, we try to figure out:

  • Which hour have the most riders flow rate?
  • Which day of the week is more popular for which age group?Which month would be best to advertise for specific age groups?
  • Where is the ideal location for certain group?

First, let’s start to analyze the relationship between each age group changes and different times of day.

In the bar chart, we can see 25 – 35 and 35 -45 take up a large portion of the bikes’ use. However, these two groups have different behaviours. , Leaving at 20:00 -23:00 and returning between 1:00 – 4:00 applies to both the younger age groups:  15-25  and 25-35 year-olds.

For 35 – 45 year-old, the riding time is relatively stable, likely because they have less nightlife. They would ride bikes to work or exercise more in the daytime.


Next, we are going to analyze how different age groups behave differently in each day.

From the 2D Histogram, we can see that 3 different age groups, ranging from  25 -35, 35 -45, and 45 -55 make up the major users. Compared to other groups, that 25 -35 year-olds would be more likely to go out on Saturday. Accordingly, it makes sense for ads to target young people on Saturday. Also, we could purposely market on the days when demand is down among a certain group to try to increase it, for example, stores and eateries put out promotions on slower days of the week rather than on days when they are already busy.

Thirdly, I use a scatter plot to illustrate how each age group tends to ride Citi Bike in each month.

In the scatter plot, we can see that15 -25, 55-65, and 65-75 remain stable throughout the year, while 25- 35 and 35 -45 have a huge deviation from month to month. The curve for 25 – 35 and 35 – 45 goes up from February to October and goes down from October to February. This variance might be caused by the weather. When the temperature gets cold, fewer people will ride a bike. So for these two group, July to November is an optimal period for targeted ads.

Lastly, I create an interactive map to show which location is popular for each age group. In this map, the area of the yellow circle represents the number of people starting their journey. On the right side of the screen, R shiny app users can choose age group, user type, gender, and date to filter out the data.

In the map, I summarize the following chart to highlight the most popular bike station for each age group.

Age Group Popular Place to Start
15 – 25 Brunswick St
25 – 35 Grove St. Path,  Sip Ave
35 – 45 Grove St. Path,   Exchange Place
45 – 55 Grove St. Path,   Sip Ave
55 – 65 Grove St. Path,  Hamilton Park
65 -75 Grove St. Path, Newark Ave

From the chart, we can see that though Grove St. Path shows up as a favourite for most of the age groups, there is quite a bit of deviation for the second rank among them. That may indicate good choices of locations to target for particular ages.


  • Grove St. Path is a nice location to target for almost for every age group.
  • If you wish to target for 25 -45 year-old at a particular time of the year, July to Nov would be a good choice.
  • Saturday seems to be a perfect date to make more promotion to 25 -35 year-old.
  • At midnight, the advertisement material would be most relevant to 25 – 35 year-old. During business hours, the advertisement would likely appeal more to those in the next three age brackets:  35 – 65 year-olds.

Next Step

I will combine both the time and location data together to further see how they react to each other and check whether there is some huge deviation from the results we have so far. I will also provide more detailed analysis for specific date and location, and expand the scope to every city in the U.S. that runs sharing bike program.



To leave a comment for the author, please follow the link and comment on their blog: R – NYC Data Science Academy Blog. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)