Created
January 12, 2016 20:13
-
-
Save aammd/d1789f34c61b45f7d91c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
library(pageviews) | |
library(dplyr) | |
library(ggplot2) | |
bowie <- article_pageviews(article = "David_Bowie", end = "2016011200") | |
since_dec <- bowie %>% | |
mutate(timestamp = lubridate::ymd_h(timestamp)) %>% | |
filter(timestamp > lubridate::ymd("2015-12-01")) | |
since_dec %>% | |
mutate(endpt = "Including 11 Jan 2016") %>% | |
rbind({ | |
since_dec %>% | |
filter(timestamp != lubridate::ymd("2016-01-11")) %>% | |
mutate(endpt = "Before 11 Jan 2016") | |
}) %>% | |
ggplot(aes(x = timestamp, y = views)) + | |
facet_wrap(~endpt, scales = "free") + | |
geom_line() + | |
theme_minimal() + | |
xlab("Date") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment