Skip to content

Instantly share code, notes, and snippets.

View ashleylester's full-sized avatar

Ashley Lester ashleylester

View GitHub Profile
library(rgdal)
library(broom)
library(dplyr)
lad_2016_sg <- readOGR(paste0("data/Local_Authority_Districts_December_2016_Super_Generalised_",
"Clipped_Boundaries_in_Great_Britain/Local_Authority_Districts_",
"December_2016_Super_Generalised_Clipped_Boundaries_in_Great_",
"Britain.shp"))
lad_2016_sg <- spTransform(lad_2016_sg, CRS("+init=epsg:4326"))
@ashleylester
ashleylester / more_mapping.R
Created March 27, 2017 00:33
More mapping
library(rgdal)
library(tidyverse)
library(scales)
la <- readOGR(paste0("Local_Authority_Districts_December_2015_Super_Generalised_Clipped_",
"Boundaries_in_Great_Britain/Local_Authority_Districts_December_2015_Super_Generalised_Clipped_",
"Boundaries_in_Great_Britain.shp"))
# Change the coordinate reference system - it's a bit easier to work with
la <- spTransform(la, CRS("+init=epsg:4326"))
@ashleylester
ashleylester / mapping_tests.R
Last active March 13, 2017 23:40
Some mapping tests using sp, ggplot, coordinate transformation, subsetting polygons...
library(ggmap) # Changes SpatialPolygonsDataFrame into a data frame
library(maptools) # Reads the shapefile
library(sp) # Assigns a CRS to the shapefile
library(tidyverse)
# Shapefile from http://geoportal.statistics.gov.uk/datasets/afcc88affe5f450e9c03970b237a7999_3
shpfile <- paste0("Datasets/Shapefile/Wards_December_2016_Super_Generalised_",
"Clipped_Boundaries_in_Great_Britain.shp")
wards <- readShapeSpatial(shpfile)
@ashleylester
ashleylester / script.R
Last active January 13, 2017 22:40
Easy way to iterate over a data frame and append multiple columns from a function returning a data frame
## An example of iterating over a data frame using the apply family and
## the tidyverse, appending multiple columns to a resultset.
library(tidyverse)
library(ggmap)
latLong <- data.frame(long= c(78.0422, -0.1246, 131.035904, 122.3493),
lat = c(27.1750, 51.5007, -25.344646, 47.6205),
name = c("Taj Mahal", "Big Ben", "Uluru", "Space Needle"))

Java Interface Notes

Interfaces are meeting points

Interfaces exist in many places and have different implications depending on their context. Interfaces exist between lots of different entities:

  • Organisations
  • Components in a system
  • Objects in an object-oriented application
  • Drivers and operating systems