ABOUT THE PROJECT: BIKE SHARE

The Bike Share Company has provided data related to casual riders and member riders who ride within the cities of USA. The duration of data being studied is from JANUARY 2023 TO JULY 2023.

STAKEHOLDERS’ EXPECTATIONS

The stakeholders’ expectations are:
1) Want to increase/maximize the number of annual membership
2) Want to attract more riders

ANALYST JOB

The analyst is asked to find
1) How casual riders and members use cyclist bikes differently?
2)How can the casual riders be converted to member?

WHAT ARE WE GOING TO DO?

  1. We are going to study different columns: rideable_type, days_of_week and member_casual; separately
  2. We are going to find out which rideable type among the classic,electric and docked bike is liked the most.
  3. We are going to have a look at the most preferred days.
  4. We are also going to find out which type of riders are more - whether the casual ones of the members.

CHALLENGES FACED

1)Delaying factors 2)Lack of knowledge 3)Some applications were not accessible.

PART 1 OF THE PROJECT

In this particular part of the project we are going to study how the riders prefer the type of bikes. There are three rideable types: ELECTRIC BIKE, DOCKED BIKE AND CLASSIC BIKE. We are trying to answer to the question:“Which bike is preferred more by the riders?”

Installed all required packages

install.packages("tidyverse")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.3'
## (as 'lib' is unspecified)
install.packages("ggplot2")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.3'
## (as 'lib' is unspecified)
install.packages("dplyr")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.3'
## (as 'lib' is unspecified)
install.packages("writexl")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.3'
## (as 'lib' is unspecified)
library('tidyverse')
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.3     ✔ readr     2.1.4
## ✔ forcats   1.0.0     ✔ stringr   1.5.0
## ✔ ggplot2   3.4.4     ✔ tibble    3.2.1
## ✔ lubridate 1.9.3     ✔ tidyr     1.3.0
## ✔ purrr     1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library('ggplot2')
library('dplyr')
library('writexl')
install.packages("reshape2")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.3'
## (as 'lib' is unspecified)
library('reshape2')
## 
## Attaching package: 'reshape2'
## 
## The following object is masked from 'package:tidyr':
## 
##     smiths

AT FIRST WE TRY TO FIND ON WHICH MONTHS DO THE RIDERS PREFER RIDING BIKES

Created a New data frame with months and the rideable bikes

rideable_df<-data.frame(MONTH=c("Jan","Feb","Mar","Apr","May","Jun","Jul"),classic_bike=c("169639","89826","107020","169617","269732","313344","361916"),docked_bike=c("8883","2194","3017","8885","13082","14964","18412"),electric_bike=c("247801","98283","148472","247827","321624","390828","386794"))
head(rideable_df)
##   MONTH classic_bike docked_bike electric_bike
## 1   Jan       169639        8883        247801
## 2   Feb        89826        2194         98283
## 3   Mar       107020        3017        148472
## 4   Apr       169617        8885        247827
## 5   May       269732       13082        321624
## 6   Jun       313344       14964        390828

Saved the dataframe in the cloud

write_xlsx(rideable_df,'/cloud/project/rideable_df.csv')

Resizing the wide data to long data

long_df <- melt(rideable_df, id.vars = "MONTH", variable.name = "bike_type", value.name = "count")
view(long_df)

Conversion to numeric format

long_df$count <- as.numeric(long_df$count)

Arranging the data from Jan to July

long_df$MONTH <- factor(long_df$MONTH, levels = c("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul"))

Visual representation

ggplot(long_df, aes(x = MONTH, y = count, fill = bike_type)) +
  geom_bar(stat = "identity", position = "dodge") +
  labs(title = "Bike Usage from January to July", x = "Month", y = "Count") +
  scale_fill_brewer(palette = "Set1") +
  theme_minimal()

Consclusion

From the above graph we come to the conclusion that there has been a gradual rise in the number of riders and we see that participation in the activity is been more during the month of June and July.

WE TRY TO FIND WHICH BIKE IS MOSTLY PREFERRED

New dataframe consisting total number of each bike

tot_bikes_each<-data.frame( bike_type=c('classic','docked','electric'),total=c('1481094','69437','1841629'))
head(tot_bikes_each)
##   bike_type   total
## 1   classic 1481094
## 2    docked   69437
## 3  electric 1841629

Creating level

tot_bikes_each$bike_type<- factor(tot_bikes_each$bike_type, levels = c("classic","electric","docked"))
data(tot_bikes_each)
## Warning in data(tot_bikes_each): data set 'tot_bikes_each' not found

Converting data to numeric form

tot_bikes_each$total <- as.numeric(tot_bikes_each$total)

Data visualisation of the bike preferrence all together

tot_bikes_each$total <- as.numeric(tot_bikes_each$total)
ggplot(data=tot_bikes_each)+
  geom_bar(mapping=aes(x=bike_type,y=total),width=0.5,stat="identity")+
  labs(title='Total bike types preferred from JANUARY TO JULY', subtitle='Graph tells the type of bike usually preferred by the riders') +
  scale_y_continuous(limits = c(0, NA))

Conclusion

The docked bike is least preferred whereas the classic bike and electric bike are mostly preferred by the riders.

PART 2 OF THE PROJECT

In this particular part of the project we are going to study which days of the week are preferred by the riders. We are trying to answer to the question:“Which days are preferred more by the riders?”

Required dataframe

The dataframe consist of sum of riders in each day of a week.

req_df<-data.frame(DAYS=c("Mon","Tue","Wed","Thr","Fri","Sat","Sun"),TOTAL=c("426323","190303","258509","426329","604438","719136","767122"))
head(req_df)
##   DAYS  TOTAL
## 1  Mon 426323
## 2  Tue 190303
## 3  Wed 258509
## 4  Thr 426329
## 5  Fri 604438
## 6  Sat 719136

Creating level

req_df$DAYS<- factor(req_df$DAYS, levels = c("Mon", "Tue", "Wed", "Thr", "Fri", "Sat", "Sun"))

Created Data visualization

ggplot(data=req_df)+
  geom_bar(mapping=aes(y=TOTAL,x=DAYS),fill="blue",width=0.5,stat="identity")+
   labs(title="DAYS OF WEEK VS TOTAL RIDERS RODE", subtitle="The day of week which the riders usually preferred to ride")

Conclusion

From the above graph we can state that riders prefer riding the bikes on Saturdays and Sundays.

PART 3 OF THE PROJECT

In this particular part of the project we are going to study whether the casual riders are more or the members.

We are trying to answer to the question:“Which type of riders are more- the casual ones or the member riders?”

Getting the joined dataset

join_df<- read.csv("join_df_casual.csv")

Melt the data frame to long format

long_df <- melt(join_df, id.vars = "member_casual", variable.name = "month", value.name = "value")

View the first few rows of the long format data frame

head(long_df)
##   member_casual month  value
## 1        casual   Jan 147182
## 2        member   Jan 279141
## 3        casual   Feb  42982
## 4        member   Feb 147321
## 5        casual   Mar  62154
## 6        member   Mar 196355

Generate a bar graph

ggplot(data=long_df)+ 
  geom_bar(mapping=aes(x = month, y = value, fill = member_casual),width=0.5,stat="identity")+
  labs(x = "Month", y = "Value", fill = "Member Casual") +
  theme_minimal() +
  ggtitle("Monthly Data for Member and Casual")

Conclusion

From the above graph we can conclude that the participation of the riders with membership has been better than the casual riders.

Finding sum

sum_df <- long_df %>%
  group_by(member_casual) %>%
  summarise(total = sum(value))
head(sum_df)
## # A tibble: 2 × 2
##   member_casual   total
##   <chr>           <int>
## 1 casual        1265758
## 2 member        2126402

Data visualisation

ggplot(data=sum_df)+
  geom_bar(mapping=aes(x=member_casual,y=total,fill=member_casual), width=0.5,stat="identity")+
  labs(title=" MEMBER CASUAL VS TOTAL", subtitle = "Graph shows the total casual riders and the total members who availed memebership")

Conclusion

From the above visualisation we can conclude that there are more member riders than the casual riders.

RECOMMENDATIONS

  1. Bike riding activity is done more in the month of June and July therefore more offers can be given during these months so the casual ones can be converted to members.
  2. Riders prefer riding in the weekends and they also prefer classical and electric bikes over docked ones hence we need to provide more number of classical and electric bikes.