Skip to content

Instantly share code, notes, and snippets.

Avatar

Ryan Watts ryanleewatts

View GitHub Profile
@ryanleewatts
ryanleewatts / Data_alert.R
Last active Apr 28, 2020
A script to check whether PHE have updated their dashboard
View Data_alert.R
# Check if we have new data
library(pacman)
p_load("slackr", "naptime", "lubridate")
# Set up a repeating loop
repeat{
# Check the current time
start_time <- lubridate::now()
# Download and read the file
download.file("https://coronavirus.data.gov.uk/downloads/csv/coronavirus-cases_latest.csv", "export/phe_data.csv", method = "libcurl")
data <- read.csv("export/phe_data.csv")
@ryanleewatts
ryanleewatts / Datawrapper_update.R
Last active Apr 24, 2020
An example of how we update a Datawrapper chart with R
View Datawrapper_update.R
# Update our worldwide cases chart
# We would replace `chartid` below with the chart’s Datawrapper id
# https://app.datawrapper.de/chart/chartid/publish
# Clean our data and get it ready for the chart
chartid <- data %>%
group_by(date) %>%
# reshape so "cases" is one column and "deaths" is another
dcast(date ~ variable, value.var = "value", fun.aggregate = sum) %>%
select(date, `Confirmed cases`, Deaths = deaths)
View keybase.md

Keybase proof

I hereby claim:

  • I am ryanleewatts on github.
  • I am ryanleewatts (https://keybase.io/ryanleewatts) on keybase.
  • I have a public key ASBNVxcFA4M0b1_UKKftYfc4LeS6IvpXBEmHIKtVOxmPVQo

To claim this, I am signing this object: