Site icon R-bloggers

PostcodesioR 0.1.1 is on CRAN

[This article was first published on R-bloggers – Eryk Walczak, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Introduction

The latest stable version of my UK geocoder package has finally made it to CRAN. PostcodesioR is a wrapper for postcodes.io and it provides multiple functions to work with UK geospatial data.

This package is based exclusively on open data provided by Ordnance Survey and Office for National Statistics and turned into an API by postcodes.io.

PostcodesioR can be used by data scientists or social scientists working with geocoded UK data. A common task when working with such data is aggregating data at different administrative levels, e.g. turning postcode-level data into counties or regions. This package can help in achieving this goal and in many other cases involving geospatial data.

Installation

The package can be installed from CRAN with

install.packages("PostcodesioR")

or from GitHub

devtools::install_github("erzk/PostcodesioR")

Once the package is installed, load it with library(PostcodesioR)

Examples

The workhorse of the package is the postcode_lookup() function which takes a postcode and returns a data frame with the following fields:

One postcode can be geocoded in the following way

rss <- postcode_lookup("EC1Y8LX")

More than one postcode can be geocoded using purrr

postcodes <- c("EC1Y8LX", "SW1X 7XL")
postcodes_df <- purrr::map_df(postcodes, postcode_lookup)

The remaining functions are demonstrated in the vignette.

Documentation and participation

To read the full documentation of the PostcodesioR package, you can follow this link to the pkgdown site.

If you want to help with developing the package, report bugs or propose pull requests, you will find the GitHub page here.

To leave a comment for the author, please follow the link and comment on their blog: R-bloggers – Eryk Walczak.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.