Skip to content

BCC-PHM/wmSpatial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wmSpatial

Created by: David Ellis
Population Health Management
Birmingham City Council

Introduction

Installation

devtools::install_github("BCC-PHM/wmSpatial")

Basic Usage

# Birmingham Council House
df1 <- data.frame(postcode = "B1 1BB")

# 5 Random West Midlands Postcodes
df2 <- data.frame(
  postcode = c("B36 9ST", "B96 6DD", "B70 7EJ", 
               "DY8 3YD", "B21 8BQ")
  )

# Find the TWO (n=2) postcodes nearest to the council house
nearest_postcode(df1, df2, n = 2)

Returns:

postcode latitude longitude local_authority nearest_pc_1 nearest_pc_2
1   B1 1BB 52.48043 -1.903448      Birmingham      B21 8BQ      B70 7EJ

Distance

The distance in km can also be calulated using distance = TRUE:

# Find the TWO (n=2) postcodes nearest to the council house with distances
nearest_postcode(df1, df2, n = 2, distance = TRUE)

Returns:

  postcode latitude longitude local_authority nearest_pc_1 dist_km_1 nearest_pc_2 dist_km_2
1   B1 1BB 52.48043 -1.903448      Birmingham      B21 8BQ      4.53      B70 7EJ      7.09

License

This repository is dual licensed under the Open Government v3 & MIT. All code can outputs are subject to Crown Copyright.

About

No description, website, or topics provided.

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
MIT-LICENSE

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

Generated from BCC-PHM/BCCproject