This file contains 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
# modify this line | |
questionable_screennames <- c("put","screennames","here") | |
### | |
library(rtweet) | |
library(dplyr) | |
library(lubridate) | |
library(ggplot2) | |
library(scales) | |
library(ggthemes) |
This file contains 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(ggplot2) | |
library(ggthemes) | |
library(lubridate) | |
# because we have a lot of csv files of mentions, and only want a few columns | |
# from each, we will us a custom read function for each csv | |
custom_read <- function(x){ |
This file contains 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(lubridate) | |
library(tidyr) | |
library(dplyr) | |
apple <- read.csv("~/Desktop/applemobilitytrends-2020-08-26.csv", | |
stringsAsFactors = FALSE) | |
# columns X2020.05.11 X2020.05.12 are missing, so for that Mon and Tue | |
# working out the median relationships between Sun and Wed and Mon and Tue | |
# and applying them using the Sun and Wed of that week. |
This file contains 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(tidyr) | |
library(lubridate) | |
library(ggplot2) | |
library(countrycode) | |
world <- readr::read_csv("https://population.un.org/wpp/Download/Files/1_Indicators%20(Standard)/CSV_FILES/WPP2019_TotalPopulationBySex.csv") | |
pops <- world %>% filter(Variant == "Medium") %>% | |
mutate(country_code = countrycode(Location, origin = 'country.name', destination = 'iso3c')) %>% | |
select(year=Time, country_code, PopTotal) | |
mort <- readr::read_csv("https://www.mortality.org/Public/STMF/Outputs/stmf.csv", skip = 1) %>% |
This file contains 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(countrycode) | |
library(lubridate) | |
library(tidyr) | |
library(ggplot2) | |
library(ggthemes) | |
library(ggrepel) | |
# apple mobility data csv from | |
# https://www.apple.com/covid19/mobility | |
amt <- read.csv("~/Desktop/applemobilitytrends-2020-05-20.csv", colClasses = "character", |
This file contains 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) | |
library(ggthemes) | |
# European Centre for Disease Control and Prevention | |
EUcdc <- read.csv("https://opendata.ecdc.europa.eu/covid19/casedistribution/csv", | |
stringsAsFactors = FALSE, fileEncoding = "UTF-8-BOM") | |
highlight_countries <- c("New_Zealand", "United_Kingdom", "United_States_of_America", | |
"Taiwan", "Sweden", "Vietnam", "Australia") |
This file contains 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 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 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 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) %>% |