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
| # 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") |