overlap_matrix: Matrix of overlaps between two sets of areas.

View source: R/overlap.R

overlap_matrixR Documentation

Matrix of overlaps between two sets of areas.

Description

A convenience function to convert output from sf::st_intersection to a sparse matrix as defined in the Matrix package.

Usage

overlap_matrix(dom1, dom2, proportion = TRUE)

Arguments

dom1

An sf object representing a domain of areal units.

dom2

An sf object representing a domain of areal units.

proportion

Logical; if TRUE, normalize so that rows sum to 1. Otherwise areas are returned.

Details

Returns a matrix H whose (i,j)th entry represent the area of the overlap between areal units dom1[i,] and dom2[j,].

Value

An matrix of overlaps.

Examples

data("acs_sf")
dom1 = acs5_2013[1:10,]
dom2 = acs5_2016[1:10,]
H1 = overlap_matrix(dom1, dom2)
H2 = overlap_matrix(dom1, dom2, proportion = FALSE)


stcos documentation built on Aug. 21, 2023, 5:13 p.m.

Related to overlap_matrix in stcos...