Skip to content

Instantly share code, notes, and snippets.

@padpadpadpad
Last active November 14, 2017 16:13
Show Gist options
  • Save padpadpadpad/bbdd40d6f92d5199d38fd86da94b0d8a to your computer and use it in GitHub Desktop.
Save padpadpadpad/bbdd40d6f92d5199d38fd86da94b0d8a to your computer and use it in GitHub Desktop.
code to get Guardian quick crossword
# load packages
library(dplyr)
library(tidyr)
# get today's date and base url in the dataframe
dat <- data.frame(date = as.character(Sys.Date()),
url = 'https://crosswords-static.guim.co.uk/gdn.quick.pdf')
# replace '-' with ''
dat <- mutate(dat, date = gsub('-', '', date))
# split the address up on the dots
dat <- separate(dat, url, into = paste('C', 1:6, sep = ''), sep = '\\.')
# create new url from columns needed for today's crossword
fullURL <- unite(dat, fullURL, c(C1, C2, C3, C4, C5, date, C6), sep = '.') %>%
pull(., fullURL)
fullURL
#open it in browser
browseURL(fullURL)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment