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
## Libraries we are going to need | |
library(tidyverse) | |
library(lubridate) | |
## Load in the data set | |
vdecls <- readxl::read_xlsx("stramkurs.xlsx", col_types=c("date")) | |
## Fixup the data set, since Excel is utter crap. There are some NA values, get | |
## rid of those | |
vdecls <- filter(vdecls, !is.na(vdecls)) | |
## The name of the column is rather irritating, fixup | |
vdecls <- rename(vdecls, timestamp = ends_with("Kurs")) | |
## Kernel density | |
p <- ggplot(vdecls, aes(timestamp)) | |
p + geom_density() | |
ggsave("density.png") | |
## Hours and weekdays are extracted so we can plot those | |
times <- vdecls %>% | |
mutate(hour = hour(timestamp), | |
wday = wday(timestamp, label=TRUE, abbr = TRUE)) | |
p <- ggplot(times, aes(hour)) | |
p + geom_histogram(stat="count") | |
ggsave("hourly.png") | |
p <- ggplot(times, aes(hour)) | |
p + geom_histogram(stat="count") + facet_grid(rows = vars(wday)) | |
ggsave("per_wday.png") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment