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
| library(dplyr) | |
| library(lubridate) | |
| library(ggplot2) | |
| EUcdc <- read.csv("https://opendata.ecdc.europa.eu/covid19/casedistribution/csv", | |
| stringsAsFactors = FALSE, fileEncoding = "UTF-8-BOM") | |
| # NZ level 4 lockdown 26 March | |
| #Boris Handshakes 3 March, | |
| EUcdc %>% | |
| filter(countriesAndTerritories %in% c("United_Kingdom", "New_Zealand")) %>% |
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
| library(readr) | |
| library(dplyr) | |
| library(tidyr) | |
| library(lubridate) | |
| library(ggplot2) | |
| # from the downloaded apple mobiblity data of the day | |
| mobl <- read_csv("applemobilitytrends-2020-05-03.csv") | |
| # colums added for each day, so get number of coluns in current data | |
| extant <- ncol(mobl) | |
| # graph specific choices |
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
| library(dplyr) | |
| library(ggplot2) | |
| library(scales) | |
| library(patchwork) | |
| # random data, ordered | |
| set.seed(2020) | |
| series1_ind <- sort(sample(0:100, 25, replace=TRUE)) | |
| series2_ind <- sort(sample(1000:30000, 25, replace=TRUE)) | |
| example <- data_frame(step=1:25, series1_ind, series2_ind) |
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
| # https://www.mbie.govt.nz/immigration-and-tourism/tourism-research-and-data/tourism-data-releases/monthly-regional-tourism-estimates/regional-tourism-estimates/regional-tourism-estimates-key-pivot-table/ | |
| # Regional Tourism Estimates key pivot table | |
| library(readxl) | |
| library(tidyr) | |
| library(dplyr) | |
| library(ggplot2) | |
| library(forcats) | |
| tourism <- read_excel("rte-pivot-table-ye-march-2015.xlsx", sheet="Database") | |
| TA_tour <- tourism %>% filter(YEMar == 2015) %>% |
We can't make this file beautiful and searchable because it's too large.
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
| "constituency","party","candidate","attribute","value" | |
| "Aberavon","Labour","Stephen Kinnock","Votes:",17008 | |
| "Aberavon","Labour","Stephen Kinnock","Vote share %:",53.8 | |
| "Aberavon","Labour","Stephen Kinnock","Vote share change:",-14.3 | |
| "Aberavon","Conservative","Charlotte Lang","Votes:",6518 | |
| "Aberavon","Conservative","Charlotte Lang","Vote share %:",20.6 | |
| "Aberavon","Conservative","Charlotte Lang","Vote share change:",2.9 | |
| "Aberavon","The Brexit Party","Glenda Davies","Votes:",3108 | |
| "Aberavon","The Brexit Party","Glenda Davies","Vote share %:",9.8 | |
| "Aberavon","The Brexit Party","Glenda Davies","Vote share change:",9.8 |
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
| library(readr) | |
| geo_mean <- read_csv("https://www.mbie.govt.nz/assets/Data-Files/Building-and-construction/Tenancy-and-housing/Rental-bond-data/Territorial-Authority/ta-geometric-mean.csv", | |
| col_types = cols( | |
| .default = col_double(), | |
| Month = col_date(format = "") | |
| )) | |
| library(dplyr) | |
| library(ggplot2) | |
| geo_mean %>% filter(Month >= as.Date("2009-01-01")) %>% | |
| mutate(govt = c(rep("National", 105), rep("Labour",25))) %>% |
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
| # tweets are assumed to be gathered for this | |
| library(stringr) | |
| library(dplyr) | |
| library(tidyr) | |
| library(ggplot2) | |
| library(ggthemes) | |
| library(ggrepel) | |
| library(Rtsne) | |
| disc <- read.csv("discussion.csv", stringsAsFactors = FALSE) |
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
| #globe map without countries distorted by polygon points being clipped by the "edge of the world" | |
| #This is my hacking around of the fuller script | |
| #https://github.com/r-spatial/sf/blob/master/demo/twitter.R | |
| #linked to from section 8.1 of https://keen-swartz-3146c4.netlify.com/plotting.html | |
| library(sf) | |
| library(maptools) | |
| library(animation) | |
| data(wrld_simpl) |
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
| library(Rtsne) | |
| library(vroom) | |
| library(dplyr) | |
| library(tidyr) | |
| library(stringr) | |
| library(ggplot2) | |
| library(ggrepel) | |
| library(janitor) | |
| # data from https://www.dragonfly.co.nz/news/2019-11-12-boty.html |
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
| library(ggplot2) | |
| library(dplyr) | |
| library(gganimate) | |
| exhale <- 5 # seconds | |
| exhaled_pause <- 3 # seconds | |
| inhale <- 4 # seconds | |
| inhaled_pause <- 4 # seconds | |
| frames_per_second = 16 | |
| exh <- data.frame(stage = rep("exhale", exhale*frames_per_second), |