# NOT RUN {
library(dplyr)
# compute the calendar layout for the data frame
calendar_df <- pedestrian %>%
filter(Sensor_ID == 13) %>%
frame_calendar(x = Time, y = Hourly_Counts, date = Date, nrow = 4)
# ggplot
p1 <- calendar_df %>%
ggplot(aes(x = .Time, y = .Hourly_Counts, group = Date)) +
geom_line()
prettify(p1)
# use in conjunction with group_by()
grped_calendar <- pedestrian %>%
filter(Year == "2017", Month == "March") %>%
group_by(Sensor_Name) %>%
frame_calendar(
x = Time, y = Hourly_Counts, date = Date, sunday = TRUE
)
p2 <- grped_calendar %>%
ggplot(aes(x = .Time, y = .Hourly_Counts, group = Date)) +
geom_line() +
facet_wrap(~ Sensor_Name, nrow = 2)
prettify(p2)
# }
# NOT RUN {
# allow for different languages
# below gives the simplief chinese label along with STKaiti font family
# if this font is installed in user's local system
prettify(p2, locale = "zh", family = "STKaiti")
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab