Learn R Programming

⚠️There's a newer version (0.2.0) of this package.Take me there.

potential

This package provides functions to compute the potential model as defined by Stewart (1941). Several options are available to customize the model, for example it is possible to fine-tune the distance friction functions or to use custom distance matrices. Some computations are parallelized to improve their efficiency.

Installation

From GitHub

Development version / unstable

require(remotes)
remotes::install_github("riatelab/potential")

Demo

library(sf)
## Linking to GEOS 3.7.1, GDAL 3.1.2, PROJ 7.1.0
library(potential)
library(cartography)
# create a regular grid
y <- create_grid(x = n3_poly, res = 20000)

# compute potentials
pot <- mcpotential(
  x = n3_pt, y = y,
  var = "POP19",
  fun = "e", span = 75000,
  beta = 2, limit = 250000, 
  ncl = 2
)
y$pot <- pot / max(pot) * 100

# create equipotential areas
equipot <- equipotential(y, var = "pot", mask = n3_poly)

# map potentials
opar <- par(mar = c(0, 0, 1.2, 0), bg = "#b5bece", no.readonly = TRUE)
choroLayer(equipot, var = "center", breaks = seq(0,100,length.out = 11), 
           col = hcl.colors(10, 'teal'),
           border = "#121725", legend.pos = "bottom", 
           lwd = .2, legend.title.txt = "Potential Intensity",
           legend.horiz = T)
layoutLayer(title = "Potentials of Population", 
            col = "#121725", coltitle = "#4dB8da",
            sources = "© EuroGeographics for the administrative boundaries and © Eurostat for data",
            horiz = F, postitle = "center", scale = F)
par(opar)

Note

This package provides access to the revamped potential-related functions initially offered by SpatialPosition.

References

Stewart, John Q. 1941. “An Inverse Distance Variation for Certain Social Influences.” Science 93 (2404): 89–90. https://doi.org/10.1126/science.93.2404.89.

Copy Link

Version

Install

install.packages('potential')

Monthly Downloads

207

Version

0.1.0

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Timothée Giraud

Last Published

November 18th, 2020

Functions in potential (0.1.0)

potential-package

Implementation of the Potential Model
create_matrix

Create a Distance Matrix Between Two Spatial Objects
equipotential

Create Polygons of Equipotential
plot_inter

Display a Spatial Interaction Function
create_grid

Create a Regularly Spaced Points Grid
n3_poly

Points and Polygons Layers of European Statistical Units (NUTS3)
mcpotential

Compute the Potential Model using Parallelization
potential

Compute the Potential Model
n3_pt

Points and Polygons Layers of European Statistical Units (NUTS3)