Learn R Programming

geocomplexity (version 0.2.0)

geocd_vector: geocomplexity for spatial vector data based on spatial dependence

Description

This function calculates geocomplexity for spatial vector data based on spatial dependence.

Usage

geocd_vector(
  sfj,
  wt = NULL,
  method = "moran",
  normalize = TRUE,
  returnsf = TRUE
)

Value

A tibble (returnsf is FALSE) or an sf object (returnsf is TRUE)

Arguments

sfj

An sf object or spatial vector object that can be converted to sf by sf::st_as_sf().

wt

(optional) Spatial weight matrix. Must be a matrix class.

method

(optional) In instances where the method is moran, geocomplexity is determined using local moran measure method. Conversely, when the method is spvar, the spatial variance of attribute data serves to characterize geocomplexity. For all other methods, the shannon information entropy of attribute data is employed to represent geocomplexity. The selection of the method can be made from any one of the three options: moran, spvar or entropy. Default is moran.

normalize

(optional) Whether to further normalizes the calculated geocomplexity. Default is TRUE.

returnsf

(optional) When returnsf is TRUE, return an sf object, otherwise a tibble. Default is TRUE.

Examples

Run this code
econineq = sf::read_sf(system.file('extdata/econineq.gpkg',package = 'geocomplexity'))
gc = geocd_vector(econineq)
gc

library(ggplot2)
library(viridis)
ggplot(gc) +
   geom_sf(aes(fill = GC_Gini)) +
   scale_fill_viridis(option = "mako", direction = -1) +
   theme_bw()

Run the code above in your browser using DataLab