# NOT RUN {
f_quarter(month.name)
f_quarter(1:12)
dates <- seq(as.Date("2000/1/1"), by = "month", length.out = 12)
f_quarter(dates)
# }
# NOT RUN {
if (!require("pacman")) install.packages("pacman")
pacman::p_load(tidyverse)
set.seed(10)
dat <- data_frame(
month = sample(month.name, 1000, TRUE),
area = sample(LETTERS[1:5], 1000, TRUE)
) %>%
mutate(quarter = factor(f_quarter(month), levels = constant_quarters)) %>%
count(quarter, area)
ggplot(dat, aes(quarter, n)) +
geom_bar(stat = 'identity') +
facet_wrap(~ area)
# }
Run the code above in your browser using DataLab