Skip to content

Instantly share code, notes, and snippets.


Ryan Watts ryanleewatts

View GitHub Profile
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
p_load("slackr", "naptime", "lubridate")
# Set up a repeating loop
# Check the current time
start_time <- lubridate::now()
# Download and read the file
download.file("", "export/phe_data.csv", method = "libcurl")
data <- read.csv("export/phe_data.csv")
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
# 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)

Keybase proof

I hereby claim:

  • I am ryanleewatts on github.
  • I am ryanleewatts ( on keybase.
  • I have a public key ASBNVxcFA4M0b1_UKKftYfc4LeS6IvpXBEmHIKtVOxmPVQo

To claim this, I am signing this object: