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 on the day which is preferred the most?
  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 visualisation

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 numberic 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 from the above visualisation

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