Skip to content

Instantly share code, notes, and snippets.

# Install and load required packages
install.packages("needs")
library(needs)
needs(tidyverse, magrittr, animation, pdftools, png, scales)
# Function that extracts data from Google Mobility PDFs
process_google_mobility <- function(country_code, start_date, end_date){
# Convert first page of PDF into high-res PNG
pdf_convert(paste0("https://www.gstatic.com/covid19/mobility/",end_date,"_",country_code,"_Mobility_Report_en.pdf"), format = "png", pages = 1, dpi = 300, filenames = "IMG1.png")
@jthomasmock
jthomasmock / qbr_scrape.R
Last active May 16, 2021 22:41
Scrape ESPN's QBR
library(jsonlite)
library(tidyverse)
library(glue)
# Example Usage
# Get NFL QBR for 2016 entire playoffs
get_nfl_qbr("2016", season_type = "Playoffs", week = NA)
# Get all games from 2016 regular season by week