zero_matrix_diag: Create a diagonal structural zero matrix

Description Usage Arguments Details Value See Also Examples

View source: R/zero_matrix_diag.R

Description

Create a structural zero matrix with TRUE on the diagonal and FALSE everywhere else. This matrix represents situtation where a movement between any pair of distinct states is permitted, but a movement from a state to itself is prohibited.

Usage

1

Arguments

state

A character vector, giving the names of the states.

basename

Prefix used to construct dimension names. Defaults to "state".

Details

Diagonal structural zero matrices are often used when modelling migration, since migration statistics often show movements between regions, but not movements within regions.

Value

A square matrix with TRUE on the diagonal, FALSE elsewhere, and dimnames constructed from states.

See Also

zero_matrix_trans deals with the general case.

Examples

1
2
3
states <- c("Thailand", "Malaysia", "Singapore")
zero_matrix_diag(states)
zero_matrix_diag(states, basename = "country")

johnrbryant/demzero documentation built on June 15, 2020, 11:39 p.m.