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(suncalc) | |
| library(dplyr) | |
| library(ggplot2) | |
| library(ggthemes) | |
| library(lubridate) | |
| quake10yr <- c("https://quakesearch.geonet.org.nz/csv?bbox=165.5420,-49.1817,-178.9893,-32.2871&minmag=0&mindepth=0&startdate=2020-02-01&enddate=2021-03-01T0:00:00", | |
| "https://quakesearch.geonet.org.nz/csv?bbox=165.5420,-49.1817,-178.9893,-32.2871&minmag=0&mindepth=0&startdate=2019-02-01&enddate=2020-02-01", | |
| "https://quakesearch.geonet.org.nz/csv?bbox=165.5420,-49.1817,-178.9893,-32.2871&minmag=0&mindepth=0&startdate=2018-01-01&enddate=2019-02-01", |
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(readxl) | |
| library(readr) | |
| library(dplyr) | |
| library(lubridate) | |
| library(ggplot2) | |
| library(ggthemes) | |
| # arrivals from provisional daily arrivals stats NZ | |
| # postive MiQ data from MoH case demographics |
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
| # example code for processing the XML New Zealand elections final data | |
| # party and cadidate vote. | |
| # source: https://electionresults.govt.nz/electionresults_2020/xml/ | |
| # | |
| # preceding this code was downloading a local copy of the NZ election | |
| # XML provisional results using wget. | |
| # Before that, since I am on a Mac, was using homebrew to install wget | |
| # then I ran the terminal command | |
| # wget -r -np -k https://electionresults.govt.nz/electionresults_2020/xml/ |
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(ggthemes) | |
| library(maps) | |
| library(mapdata) | |
| combined <- read.csv("combined.csv", stringsAsFactors = FALSE) | |
| top_support <- max(combined$vote) | |
| # keep in mind one polling place can provide for multiple electorates |
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
| # example code for processing the XML New Zealand elections provisional data | |
| # party vote only, but is extendable to cadidate vote. | |
| # source: https://electionresults.govt.nz/electionresults_2020_preliminary/xml/ | |
| # | |
| # preceding this code was downloading a local copy of the NZ election | |
| # XML provisional results using wget. | |
| # Before that, since I am on a Mac, was using homebrew to install wget | |
| # then I ran the terminal command | |
| # wget -r -np -k https://electionresults.govt.nz/electionresults_2020_preliminary/xml/ |
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
| # modify this line | |
| questionable_screennames <- c("put","screennames","here") | |
| ### | |
| library(rtweet) | |
| library(dplyr) | |
| library(lubridate) | |
| library(ggplot2) | |
| library(scales) | |
| library(ggthemes) |
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(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 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(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 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(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 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(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", |