Last active
October 21, 2021 09:54
-
-
Save jrosell/7cde427d5f6f9dec0fb4ca3ee558dd81 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
if(!require(timetk)) install.packages("timetk") | |
# Week number in x axis with daily data in y | |
timetk::bike_sharing_daily %>% | |
filter(dteday > '2012-11-01') %>% | |
ggplot(aes(dteday, windspeed)) + | |
geom_line() + | |
scale_x_date( | |
date_breaks = "1 week", | |
date_labels = "%W" | |
) + | |
labs(x = "week") | |
# Week number in x axis with average weekly data in y | |
bike_sharing_weekly <- timetk::bike_sharing_daily %>% | |
filter(dteday > '2012-11-01') %>% | |
group_by(week = lubridate::week(dteday)) %>% | |
summarise(windspeed = mean(windspeed)) | |
bike_sharing_weekly %>% | |
ggplot(aes(week, windspeed)) + | |
geom_line() + | |
scale_x_continuous(n.breaks = nrow(bike_sharing_weekly)) + | |
labs(y = "windspeed mean") | |
Author
jrosell
commented
Oct 21, 2021
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment