Created
May 15, 2021 21:09
-
-
Save RamiKrispin/4817618c62c7e04e8910fc867dcc66cd to your computer and use it in GitHub Desktop.
Example for creating weekly index
This file contains hidden or 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
| df <- data.frame(date = seq.Date(from = as.Date("2020-01-01"), | |
| length.out = 100, | |
| by = "week")) %>% | |
| dplyr::mutate(week_index = 1 + (as.numeric(date) - as.numeric(min(date)))/7) | |
| head(df) |
Author
RamiKrispin
commented
May 15, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment