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
DATA_DIR = /Users/aaron/Google\ Drive/Data/Geographic/NZ/Topographic | |
nzlakes: nzlakes50.shp nzlakes250.shp nzlakes500.shp | |
nzlakes50.shp: $(DATA_DIR)/50k/nz-lake-polygons-topo-150k/nz-lake-polygons-topo-150k.shp | |
rm -f temp.* | |
ogr2ogr temp.shp $(DATA_DIR)/50k/nz-lake-polygons-topo-150k/nz-lake-polygons-topo-150k.shp -nln temp | |
ogr2ogr nzlakes50.shp temp.shp -sql "SELECT name, OGR_GEOM_AREA/1000 as area FROM temp" -t_srs EPSG:4326 | |
rm temp.* |
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
# Maps of overlays in the IHP recommended Auckland Unitary Plan | |
# Setup | |
rm(list = ls()) | |
library(maptools) | |
crs_nztm = CRS("+proj=tmerc +lat_0=0 +lon_0=173 +k=0.9996 +x_0=1600000 +y_0=10000000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs") | |
# Map config | |
line_width = 1 | |
line_colour = rgb(100/255, 100/255, 100/255) |
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
# Fun with Unitary Plan data -- all the things! | |
# Setup | |
rm(list = ls()) | |
library(maptools) | |
crs_nztm = CRS("+proj=tmerc +lat_0=0 +lon_0=173 +k=0.9996 +x_0=1600000 +y_0=10000000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs") | |
# Map config | |
line_width = 1 | |
point_size = 0.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
# Perform simple regressions on random walks and analyse the results | |
# Setup | |
rm(list = ls()) | |
library(broom) | |
reps = 1000 | |
walk_length = 100 | |
# Generate a random walk of length n | |
generateRandomWalk = function(n) { |
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
# Regress a random walk on a bunch of others and choose the model with the highest R-squared | |
# Analyse out-of-sample forecasting performance of that model | |
# Setup | |
rm(list = ls()) | |
walk_length = 100 | |
reps = 100 | |
# Generate a random walk of length n | |
generateRandomWalk = function(n) { |
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
# ----------------------------------------------------------------------------- | |
# Setup | |
library(magrittr) | |
library(lubridate) | |
library(tidyverse) | |
library(ggplot2) | |
library(scales) | |
source("clean-ggplot-theme.R") | |
# ----------------------------------------------------------------------------- |
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) | |
dat <- data.frame(x = 1:10, y = runif(10)) | |
chart <- ggplot(dat) + | |
geom_bar(aes(x = x, y = y), stat = "identity") + | |
geom_text(aes(x = 2, y = 1.5, label = "This text is jaggy"), size = 6) | |
print(chart) |
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
# Map Christchurch property data | |
# ----------------------------------------------------------------------------- | |
# Setup | |
rm(list = ls()) | |
library(magrittr) | |
library(lubridate) | |
library(tidyverse) | |
library(scales) | |
library(sf) |
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
# ----------------------------------------------------------------------------- | |
# Setup | |
rm(list = ls()) | |
library(magrittr) | |
library(jsonlite) | |
library(httr) | |
library(lubridate) | |
library(tidyverse) | |
library(scales) | |
source("clean-ggplot-theme.R") |
OlderNewer