The stakeholders’ expectations are:
1) Want to increase/maximize the number of annual membership
2) Want to attract more riders
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?
1)Delaying factors 2)Lack of knowledge 3)Some applications were not accessible.
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?”
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
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
write_xlsx(rideable_df,'/cloud/project/rideable_df.csv')
long_df <- melt(rideable_df, id.vars = "MONTH", variable.name = "bike_type", value.name = "count")
view(long_df)
long_df$count <- as.numeric(long_df$count)
long_df$MONTH <- factor(long_df$MONTH, levels = c("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul"))
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()
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.
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
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
tot_bikes_each$total <- as.numeric(tot_bikes_each$total)
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))
The docked bike is least preferred whereas the classic bike and electric bike are mostly preferred by the riders.
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?”
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
req_df$DAYS<- factor(req_df$DAYS, levels = c("Mon", "Tue", "Wed", "Thr", "Fri", "Sat", "Sun"))
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")
From the above graph we can state that riders prefer riding the bikes on Saturdays and Sundays.
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?”
join_df<- read.csv("join_df_casual.csv")
long_df <- melt(join_df, id.vars = "member_casual", variable.name = "month", value.name = "value")
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
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")
From the above graph we can conclude that the participation of the riders with membership has been better than the casual riders.
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
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")
From the above visualisation we can conclude that there are more member riders than the casual riders.