We can't make this file beautiful and searchable because it's too large.
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
"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 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 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 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 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 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), |
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
# my solution to https://github.com/thoughtfulbloke/tourgroups | |
library(dplyr) | |
library(tidyr) | |
tours <- read.csv("tours.csv",stringsAsFactors = FALSE) | |
visitors <- read.csv("visitors.csv",stringsAsFactors = FALSE) | |
# make it about 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(rvest) | |
library(dplyr) | |
library(tidyr) | |
library(ggplot2) | |
library(stringr) | |
library(ggbeeswarm) | |
html = read_html("https://www.electionresults.govt.nz/electionresults_2017/electorate-status.html") | |
lnks <- (html %>% html_nodes("a") %>% html_attr("href"))[25:95] | |
urls <- tibble(lnks) %>% separate(lnks, into=c("before","url"), sep=2) | |
x <- urls$url[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
Iteration | Candidate | Votes | Change | |
---|---|---|---|---|
1 | BARBOUR-EVANS Scout | 729 | NA | |
1 | BARKER Sophie | 1209 | NA | |
1 | BARLIN Bob | 867 | NA | |
1 | BENSON-POPE David | 1926 | NA | |
1 | CAMPBELL Finn | 664 | NA | |
1 | DAVIE-NITIS Sarah | 973 | NA | |
1 | ELDER Rachel | 1227 | NA | |
1 | FORSYTH Hugh | 126 | NA | |
1 | GAREY Christine | 3822 | NA |
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(foreign) # read NZESin SPSS files | |
library(dplyr) # general data manipulation | |
library(tidyr) # restructuring | |
library(ggplot2) | |
library(ggthemes) | |
# NZES files in nzes subfolder | |
nz17 <- suppressWarnings(read.spss("nzes/NZES2017Release14-07-19.sav", | |
to.data.frame = TRUE, add.undeclared.levels = "sort")) | |
nz17meta <- data.frame(varnames = attributes(nz17)$names, eyear=2017, |