Last active
June 15, 2018 18:12
-
-
Save chichacha/fd08926ed7545009c3befc5086a69345 to your computer and use it in GitHub Desktop.
Calendar For Current Year (Monday as Start Date)
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
## 2018 Calendar | |
library(tidyverse) | |
library(hrbrthemes) | |
library(scales) | |
library(lubridate) | |
library(ggthemes) | |
## Set Global Option for Lubridate | |
options("lubridate.week.start"=1) ## 1 sets to Monday | |
Sys.setenv(TZ = "America/Vancouver") | |
calendar.tbl <- tibble( | |
date = seq.Date(from=floor_date(today(),"year"), to=ceiling_date(today(),"year")-1, by="day"), | |
wk = week(date), | |
mo = month(date, label=T), | |
day = day(date), | |
wday = wday(date, label=T), | |
week.start.day = floor_date(date,"week"), | |
mo_alt = month(week.start.day,label=T, abbr=F), | |
mo.445 = dense_rank(cut(wk,c(0,4,8,13,17,21,26,30,34,39,43,47,52,56))), | |
qt.445 = quarter(mo.445) | |
) | |
ggplot(calendar.tbl, aes(x=wday, y=wk)) + | |
geom_tile(color="white", aes(fill=factor(mo.445))) + | |
geom_text(aes(label=format(date,"%e")), family="Roboto Condensed", color="white") + | |
scale_y_reverse(breaks=c(1:53)) + | |
facet_wrap(~mo, scales="free", ncol=3) + | |
theme_ipsum_rc() + | |
labs(title="2018 Calendar", subtitle="With Week Number Listed") + | |
scale_fill_tableau("cyclic", name="445 Month") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment