I'm currently graphing the cumulative miles I've run/biked/swam etc. by day. I've recorded this data via various GPS devices. I currently have a working graph that displays the days of the week out of order. How can I order the days of the week in chronological order? My code and dataframe are below. Thanks for the help.
dayofweek <- mydata %>% select(type, distance2, start_day,) %>%
group_by(start_day) %>%
summarize(distance2 = sum(distance2), na.rn=TRUE) %>%
ggplot(aes(x = start_day, y = distance2))+
geom_bar(stat="identity")+
theme_bw(10)
dayofweek <- dayofweek + labs(title = "Workout Mileage",
subtitle = "Broken out by Day of the Week",
caption = "Data source: Strava",
x = "Day of the Week",
y= "# of Miles")
dayofweek
Edit (solved thanks to sconfluentus):
I added this at the start of my code:
mydata$start_day <- factor(mydata$start_day,
levels = c("Sun", "Mon",
"Tue", "Wed", "Thu", "Fri", "Sat"))
which yields this: