Skip to content

Instantly share code, notes, and snippets.

View yanhann10's full-sized avatar

hannah yan han yanhann10

View GitHub Profile
library(needs)
# gganimate: devtools::install_github("dgrtwo/gganimate")
needs(ggplot2, gganimate, dplyr, viridis)
# HadCRUT4.4
file_url = "http://www.metoffice.gov.uk/hadobs/hadcrut4/data/current/time_series/HadCRUT.4.4.0.0.monthly_ns_avg.txt"
if(!file.exists("data.txt")) download.file(file_url, "data.txt")
read.table("data.txt", "", header = F, stringsAsFactors = F) %>%
mutate(Date = as.Date(sprintf("%s/01", V1), "%Y/%m/%d")) %>%