Shanghai_zoo %>%
mutate(Week = ceiling(day / 7),
Day_str = factor(weekdays(day, abbreviate = TRUE),
levels = c('1', '2', '3', '4', '5', '6', '7'))) %>%
group_by(year, season, month, Day_str) %>%
summarize(DayMax = max(Value)) %>%
ggplot(aes(Week, Day_str, fill = DayMax)) +
geom_tile(colour = "white") +
facet_grid(Year ~ Month) +
scale_fill_gradient2(high = "black", mid ="red", low = "blue") +
labs(x="Week of Month",
y="",
title = "Time-Series Calendar Heatmap",
subtitle="Chengdu - PM2.5 level",
fill = "PM2.5 level")
It appears error following:
Error: Evaluation error: no applicable method for 'weekdays' applied to an object of class "c('integer', 'numeric')".
So should i paste my dataset here?