View source: R/equipotential.R
equipotential | R Documentation |
This function creates polygons of equipotential from a regular grid of potential points.
equipotential(x, var, nclass = 8, breaks, mask, buffer, xcoords, ycoords)
x |
an sf object of regularly spaced points. |
var |
name of the variable to use in |
nclass |
a number of class. |
breaks |
a vector of break values. |
mask |
an sf object of polygons or multipolygons. |
buffer |
if set, a buffer is added to the mask in order to
reach more precisely the number of breaks. The buffer is defined in
|
xcoords |
not used. |
ycoords |
not used. |
The output is an sf object (POLYGONS). The data frame contains four fields: id (id of each polygon), min and max (minimum and maximum breaks of the polygon) and center (central values of classes).
library(sf) y <- create_grid(x = n3_poly, res = 200000) d <- create_matrix(n3_pt, y) pot <- potential( x = n3_pt, y = y, d = d, var = "POP19", fun = "e", span = 200000, beta = 2 ) y$OUTPUT <- pot equipot <- equipotential(y, var = "OUTPUT", mask = n3_poly) plot(equipot["center"], pal = hcl.colors(nrow(equipot), "cividis"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.