Background

Cyclistic’s finance analysts have concluded that annual members are much more profitable than casual riders. Although the pricing flexibility helps Cyclistic attract more customers, Lily Moreno (director of marketing) believes that maximizing the number of annual members will be key to future growth. Rather than creating a marketing campaign that targets all-new customers, Moreno believes there is a solid opportunity to convert casual riders into members. She notes that casual riders are already aware of the Cyclistic program and have chosen Cyclistic for their mobility needs. Moreno has set a clear goal: Design marketing strategies aimed at converting casual riders into annual members. In order to do that, however, the team needs to better understand how annual members and casual riders differ, why casual riders would buy a membership, and how digital media could affect their marketing tactics. Moreno and her team are interested in analyzing the Cyclistic historical bike trip data to identify trends.

The business task

The business task about how annual members and casual riders use Cyclistic bikes differently can be identified as:

“Analyzing User Behavior Patterns of Cyclistic’s Annual Members and Casual Riders”

Data Source

Previous 12 months of Cyclistic trip data

library(tidyverse)
library(dplyr)
library(tidyr)
library(magrittr)
library(knitr)
library(lubridate)
library(tibble)
library(ggplot2)
library(sf)

Data Cleaning/Manipulation

Documentation of any cleaning or manipulation of data

Data downloaded was saved in a folder(“path”) and imported into RStudio

files <- list.files(path = "path", pattern = ".csv$", recursive = TRUE, full.names = TRUE)

Files ere combined into “data” table

data <- tibble(read_csv(files) %>% bind_rows()) %>% glimpse()

Compute ride_length, Day of the week(Weekday) and Weekday/WeekEnd

#calculate ride length
#calculate Day of the week(Weekday)
#calculate weekday/weekend
data <- 
  mutate(data, ride_length = data$ended_at - data$started_at) %>%
  mutate(weekday = base::weekdays(as.Date(data$started_at), abbreviate = TRUE )) %>%
  mutate(data, day = 
           case_when (
             data$weekday == "Sat" | data$weekday == "Sun" ~ "Weekend", 
             .default = "Weekday"))

Assigned data types to factors, included “levels”

#assign data type to factors
data$member_casual <- as.factor(data$member_casual)
data$rideable_type <- as.factor(data$rideable_type)
data$weekday <- factor((data$weekday), levels = c("Mon","Tue","Wed","Thu","Fri","Sat","Sun"))

Filtered out rides shorter than 30sec (rides too short of a duration) and “docked_bikes” (parked bikes).

#filter away docked bicycles
#filter ride length >= 30 secs
dataClean <- data %>% 
  filter(rideable_type != "docked_bike") %>% 
  filter(ride_length >= 30)

Summary of Analysis & Supporting visualizations and key findings

The summary of my analysis is as follows:

1.A higher ratio of casual riders ride on weekends (66% of trips) as compared to (52% of trips)

see tibble&data visualization below.

summary <- 
  dataClean %>% group_by(member_casual) %>% count(day) %>% 
  group_by(member_casual) %>% 
  mutate(weighted_n = case_when(day == "Weekday" ~ n/7,.default = n/2)) %>% 
  mutate(weighted_rate = weighted_n/sum(weighted_n))
summary %>% 
ggplot(aes(x = day, fill = member_casual)) + 
    geom_bar(aes(y = weighted_rate ), stat='identity',position = "dodge") +
    scale_y_continuous(labels = scales::percent) +
    geom_text(summary, 
              mapping = aes(label = paste(round(weighted_rate*100), "%"), 
                        y = weighted_rate + 0.01),
              position = position_dodge(0.9),
              vjust = 0) +
    labs(
      x = 'Weekday/Weekend', 
      y = '% of Trips', 
      title="% Trips by Rider Type",
      caption = "Data source: Divvy system data, 12/2022-11/2023",
      fill="Rider Type"
    )

2.There is a much higher percentage of member riders ride to work or as part of the traveling to work as illustrated by visualization “Hourly Trips by rider type”

dataClean <- dataClean %>% 
    mutate(hour = make_datetime(hour = hour(dataClean$started_at)))
ggplot(dataClean, aes(x = hour, fill = member_casual)) +
  geom_histogram(aes(y = after_stat(density)),position = "dodge",bins = 12) + 
  facet_wrap(~vars(day)) + 
  scale_y_continuous(labels = scales::percent) +
  scale_x_datetime(date_labels = "%I %p", 
                   limits = c(make_datetime(hour = 0, min = 0),
                              make_datetime(hour = 23, min = 59))) +
  labs(
    x = 'Time of Day', 
    y = '% of Riders', 
    title="Hourly Trips by Rider Type",
    caption = "Data source: Divvy system data, 12/2022-11/2023",
    fill="Rider Type"
  ) +
  theme(
    axis.text.x=element_text(angle=60, hjust=1),
    legend.title.align = 0.5,
    axis.text = element_text(face="bold"),
    legend.key=element_rect(colour="white")
  )


My top 3 rcommendations based on my analysis

Based on the analysis of Cyclistic’s user behavior patterns, here are the top three recommendations for the director of marketing to design strategies aimed at converting casual riders into annual members:

  1. Targeted Weekend Promotions for Casual Riders: Since a higher ratio of casual riders use the service on weekends, marketing efforts should focus on weekend-specific promotions. These could include special weekend-only membership rates, discounts for converting to annual membership during weekends, or weekend loyalty programs. For instance, offering a discount on the next week’s rides if a casual rider converts to a member on the weekend could be effective. This approach leverages the existing preference of casual riders for weekend usage, making the offer more relevant and attractive to them.

  2. Highlight Commuting Benefits for Members: Given that a significant percentage of member riders use the service for commuting to work, marketing campaigns should emphasize the benefits of membership for regular commuting. This can include showcasing cost savings over time, convenience, health benefits, and environmental impact. Testimonials or case studies from current members who use the service for commuting could be powerful in illustrating these benefits. Additionally, partnerships with local businesses or employers to offer discounted memberships as part of employee benefits could also be effective.

  3. Leverage Data-Driven Personalization in Campaigns: Utilize the data collected to create personalized marketing messages. For casual riders who frequently use the service on weekends, tailor communications highlighting how an annual membership could be more economical for their usage patterns. For those who have occasionally used the service on weekdays, focus on the commuting benefits. Personalization can significantly increase the relevance and effectiveness of the marketing messages, making the proposal to switch to an annual membership more compelling.

These recommendations are designed to address the specific usage patterns and preferences of Cyclistic’s two primary customer segments, thereby making the marketing strategies more focused and potentially more effective in converting casual riders into annual members.