Happy first birthday π
One year, visualised
Thereβs been 27 posts on rostrum.blog in its first year, so about one every two weeks.
This interactive graphic shows the publishing frequency, where each dot is a post and the x-axis is time. Turn your mobile to landscape mode to see it in full.
Expand for code
# The data for the plot was scraped using {rvest} and visualised
# with {ggplot2} and {plotly}.
# Load packages
library(dplyr) # data manipulation
library(rvest) # web scrape
library(stringr) # string manipulation
library(lubridate) # deal with dates
library(ggplot2) # plots
library(plotly) # interactive plots
# Scrape the rostrum.blog home page
html <- read_html("https://rostrum.blog/") # the site's homepage lists the posts
# Extract the post titles
title <- html %>%
html_nodes(".archive-item-link") %>% # node identified with SelectorGadget
html_text() # extract the text from the node
# Extract the post dates
date <- html %>%
html_nodes(".archive-item-date") %>% # element with the data we care about
html_text() %>% # convert to text
str_replace_all("\n|[:space:]", "") # replace newline-space with blank
# Dataframe of titles and dates
posts <- tibble(title = title, publish_date = date) %>%
mutate(publish_date = ymd(date)) %>% # make column datetime
arrange(publish_date) %>% # order by date
filter(publish_date < "2019-04-14") # only posts before this one
# Create plot object
p <- posts %>%
mutate(count = 1) %>% # dummy to indicate a post was made
ggplot(aes(x = publish_date, y = count, label = title)) +
geom_point(color = "#1D8016") + # match the rostrum.blog green
theme_void() + # strip plot elements
theme(panel.grid = element_blank()) # to stop plotly rendering grid
# Object telling {plotly} not to do axes, etc
ax <- list(
title = "",
zeroline = FALSE,
showline = FALSE,
showticklabels = FALSE,
showgrid = FALSE
)
# Pass the plot object to plotly (actually performed outside this code chunk)
ggplotly(
p, # plot object
tooltip = c("publish_date", "title") # add mousover info
) %>%
layout(xaxis = ax, yaxis = ax) %>% # remove axes
config(displayModeBar = FALSE) # don't show plotly toolbar
More to come
You can continue to expect more posts about important topics like Pokemon, Dawsonβs Creek, Kanye West, the National Basketball Association, Star Trek and dead deer.
I hope youβve learnt something new about R, like how to begin using it, how to create reproducible reports, how to create interactive maps, how to build network graphs, how to webscrape, how to build simple serverless apps, how to debug tidyverse pipelines, or just remind yourself that you can do it.
Session info
## [1] "Last updated 2020-01-02"
## β Session info βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
## setting value
## version R version 3.6.1 (2019-07-05)
## os macOS Sierra 10.12.6
## system x86_64, darwin15.6.0
## ui X11
## language (EN)
## collate en_GB.UTF-8
## ctype en_GB.UTF-8
## tz Europe/London
## date 2020-01-02
##
## β Packages βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
## package * version date lib source
## assertthat 0.2.1 2019-03-21 [1] CRAN (R 3.6.0)
## backports 1.1.5 2019-10-02 [1] CRAN (R 3.6.0)
## blogdown 0.17 2019-11-13 [1] CRAN (R 3.6.0)
## bookdown 0.16 2019-11-22 [1] CRAN (R 3.6.0)
## cli 2.0.0 2019-12-09 [1] CRAN (R 3.6.1)
## colorspace 1.4-1 2019-03-18 [1] CRAN (R 3.6.0)
## crayon 1.3.4 2017-09-16 [1] CRAN (R 3.6.0)
## crosstalk 1.0.0 2016-12-21 [1] CRAN (R 3.6.0)
## curl 4.3 2019-12-02 [1] CRAN (R 3.6.0)
## data.table 1.12.8 2019-12-09 [1] CRAN (R 3.6.0)
## digest 0.6.23 2019-11-23 [1] CRAN (R 3.6.0)
## dplyr * 0.8.3 2019-07-04 [1] CRAN (R 3.6.0)
## emo 0.0.0.9000 2019-12-23 [1] Github (hadley/emo@3f03b11)
## evaluate 0.14 2019-05-28 [1] CRAN (R 3.6.0)
## fansi 0.4.0 2018-10-05 [1] CRAN (R 3.6.0)
## fastmap 1.0.1 2019-10-08 [1] CRAN (R 3.6.0)
## ggplot2 * 3.2.1 2019-08-10 [1] CRAN (R 3.6.0)
## glue 1.3.1 2019-03-12 [1] CRAN (R 3.6.0)
## gtable 0.3.0 2019-03-25 [1] CRAN (R 3.6.0)
## htmltools 0.4.0 2019-10-04 [1] CRAN (R 3.6.0)
## htmlwidgets 1.5.1 2019-10-08 [1] CRAN (R 3.6.0)
## httpuv 1.5.2 2019-09-11 [1] CRAN (R 3.6.0)
## httr 1.4.1 2019-08-05 [1] CRAN (R 3.6.0)
## jsonlite 1.6 2018-12-07 [1] CRAN (R 3.6.0)
## knitr 1.26 2019-11-12 [1] CRAN (R 3.6.0)
## labeling 0.3 2014-08-23 [1] CRAN (R 3.6.0)
## later 1.0.0 2019-10-04 [1] CRAN (R 3.6.0)
## lazyeval 0.2.2 2019-03-15 [1] CRAN (R 3.6.0)
## lifecycle 0.1.0 2019-08-01 [1] CRAN (R 3.6.0)
## lubridate * 1.7.4 2018-04-11 [1] CRAN (R 3.6.0)
## magrittr 1.5 2014-11-22 [1] CRAN (R 3.6.0)
## mime 0.8 2019-12-19 [1] CRAN (R 3.6.0)
## munsell 0.5.0 2018-06-12 [1] CRAN (R 3.6.0)
## pillar 1.4.3 2019-12-20 [1] CRAN (R 3.6.0)
## pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 3.6.0)
## plotly * 4.9.1 2019-11-07 [1] CRAN (R 3.6.0)
## promises 1.1.0 2019-10-04 [1] CRAN (R 3.6.0)
## purrr 0.3.3 2019-10-18 [1] CRAN (R 3.6.0)
## R6 2.4.1 2019-11-12 [1] CRAN (R 3.6.0)
## Rcpp 1.0.3 2019-11-08 [1] CRAN (R 3.6.0)
## rlang 0.4.2 2019-11-23 [1] CRAN (R 3.6.0)
## rmarkdown 2.0 2019-12-12 [1] CRAN (R 3.6.0)
## rstudioapi 0.10 2019-03-19 [1] CRAN (R 3.6.0)
## rvest * 0.3.5 2019-11-08 [1] CRAN (R 3.6.0)
## scales 1.1.0 2019-11-18 [1] CRAN (R 3.6.0)
## selectr 0.4-2 2019-11-20 [1] CRAN (R 3.6.0)
## sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 3.6.0)
## shiny 1.4.0 2019-10-10 [1] CRAN (R 3.6.0)
## stringi 1.4.3 2019-03-12 [1] CRAN (R 3.6.0)
## stringr * 1.4.0 2019-02-10 [1] CRAN (R 3.6.0)
## tibble 2.1.3 2019-06-06 [1] CRAN (R 3.6.0)
## tidyr 1.0.0 2019-09-11 [1] CRAN (R 3.6.0)
## tidyselect 0.2.5 2018-10-11 [1] CRAN (R 3.6.0)
## vctrs 0.2.1 2019-12-17 [1] CRAN (R 3.6.1)
## viridisLite 0.3.0 2018-02-01 [1] CRAN (R 3.6.0)
## withr 2.1.2 2018-03-15 [1] CRAN (R 3.6.0)
## xfun 0.11 2019-11-12 [1] CRAN (R 3.6.0)
## xml2 * 1.2.2 2019-08-09 [1] CRAN (R 3.6.0)
## xtable 1.8-4 2019-04-21 [1] CRAN (R 3.6.0)
## yaml 2.2.0 2018-07-25 [1] CRAN (R 3.6.0)
## zeallot 0.1.0 2018-01-28 [1] CRAN (R 3.6.0)
##
## [1] /Users/matt.dray/Library/R/3.6/library
## [2] /Library/Frameworks/R.framework/Versions/3.6/Resources/library