Learn R Programming

stplanr (version 0.0.2)

cents: SpatialPointsDataFrame of home locations for flow analysis.

Description

These points represent population-weighted centroids of Medium Super Output Area (MSOA) zones within a 1 mile radius of of my home when I was writing this package.

Usage

data(cents)

Arguments

format

A SpatialPoints with 8 rows and 5 variables

Details

A dataset containing the prices and other attributes of almost 54,000 diamonds. The variables are as follows:

  • geo_code. the official code of the zone
  • MSOA11NM. name zone name
  • percent_fem. the percent female
  • avslope. average gradient of the zone

Cents was generated from the data repository pct-data: https://github.com/npct/pct-data. This data was accessed from within the pct repo: https://github.com/npct/pct, using the following code:

Examples

Run this code
cents <- rgdal::readOGR(dsn = "~/repos/pct/pct-data/national/cents.geojson", layer = "OGRGeoJSON")
# library(geojsonio) # load with the ropensci package geojsonio if rgdal fails
# cents <- geojsonio::geojson_read(x = "~/repos/pct/pct-data/national/cents.geojson")
crs <- CRS("+init=epsg:4326")
crsuk <- CRS("+init=epsg:27700")
cents <- sp::spTransform(x = cents, CRSobj = crsuk)
home <- rev(RgoogleMaps::getGeoCode("LS7 3HB"))
home <- sp::SpatialPoints(coords = home, proj4string = crs)
home <- sp::spTransform(x = home, CRSobj = crsuk)
buf <- rgeos::gBuffer(home, width = 2000)
# Check it saved the points OK
cents <- cents[buf,]
plot(buf)
points(cents)
cents <- sp::spTransform(x = cents, CRSobj = crs)
library(devtools)
use_data(cents)

Run the code above in your browser using DataLab