I'm creating a graph in R that shows the total number of rides per month. Actually, the start month is April 2020 and the end month is March 2021. This arrangement has an important meaning in analyzing and explaining for others. However, since R automatically orders it from 1 => 12 so I would like to ask whether there is another way for me to rearrange this?
library(ggplot2);library(dplyr)
Bike %>%
group_by(member_casual, Date_month) %>%
summarise(.groups = 'drop',
average_duration = mean(Time_duration)) %>%
arrange(member_casual, Date_month) %>%
mutate(Average_Time = hms(average_duration)) %>%
ggplot(aes(
x = Date_month,
y = Average_Time,
group = member_casual,
colour = member_casual
)) +
geom_line() + geom_point(size = 3) +
scale_colour_manual(name = "Membership Type",
values = c(casual = '#ff9900', member = '#0099cc')) +
labs(
title = "Average Ride Duration By Month",
x = "Month",
y = "Average Time",
subtitle = "April 2020 to March 2021"
)