divide_carto {bigDM}R Documentation

Divide the spatial domain into subregions

Description

The function takes an object of class SpatialPolygonsDataFrame or sf and divides it into subregions according to some grouping variable.

Usage

divide_carto(carto, ID.group = NULL, k = 0, plot = FALSE)

Arguments

carto

object of class SpatialPolygonsDataFrame or sf.

ID.group

character vector of grouping identifiers.

k

numeric value with the neighbourhood order to add polygons at the border of the spatial subdomains. If k=0 (default) a disjoint partition is defined.

plot

logical value (default FALSE), if TRUE then the spatial polygons within each subdomain are ploted.

Value

List of sf objects with the spatial polygons of each subdomain.

Examples

## Not run: 
library(tmap)

## Load the Spain colorectal cancer mortality data ##
data(Carto_SpainMUN)

## Plot of the grouping variable 'region' ##
tm_shape(Carto_SpainMUN) +
  tm_polygons(col="region") +
  tm_layout(legend.outside=TRUE)

## Disjoint partition ##
carto.k0 <- divide_carto(carto=Carto_SpainMUN, ID.group="region", k=0)

## Partition + 1st order neighbours ##
carto.k1 <- divide_carto(carto=Carto_SpainMUN, ID.group="region", k=1)

## Partition + 2nd order neighbours ##
carto.k2 <- divide_carto(carto=Carto_SpainMUN, ID.group="region", k=2)

## Plot the spatial polygons for the autonomous region of Castilla y Leon ##
plot(carto.k2$`Castilla y Leon`$geometry, col="dodgerblue4", main="Castilla y Leon")
plot(carto.k1$`Castilla y Leon`$geometry, col="dodgerblue", add=TRUE)
plot(carto.k0$`Castilla y Leon`$geometry, col="lightgrey", add=TRUE)

## End(Not run)


[Package bigDM version 0.5.3 Index]