distmatrix: Generate between-country distance matrix on the CShapes...

Description Usage Arguments Value

View source: R/distmatrix.R

Description

This function returns between-country distances in km for the given date. Output format is a distance matrix that lists distances between each pair of countries. The function can compute different types of distance lists, specified by the type parameter:

  1. Capital distances

  2. Centroid distances

  3. Minimum distances between polygons

The latter computation is very expensive if polygons consist of many points. For that reason, the function simplifies the country polygons according to the Douglas-Peucker algorithm (http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm), which eliminates points from the polygons and speeds up computation. The keep parameter specifies the proportion of points to retain in the simplified country polygons.

Usage

1
2
3
4
5
6
7
distmatrix(
  date,
  type = "mindist",
  keep = 0.1,
  useGW = TRUE,
  dependencies = FALSE
)

Arguments

date

The date for which the distance matrix should be computed. This argument must be of type Date and must be in the range 1/1/1886 - end of the dataset.

type

Specifies the type of distance matrix: "capdist" for capital distances, "centdist" for centroid distances, and "mindist" for minimum distances.

keep

Proportion of points to retain following polygon simplification using Douglas-Peucker algorithm. Default: 0.1. See package rmapshaper.

useGW

Boolean argument specifying the system membership coding. TRUE: Gleditsch and Ward (GW, default). FALSE: Correlates of War (COW).

dependencies

Boolean argument specifying whether dependent territories must be included. TRUE: Returns polygons for both independent states and dependent units. FALSE: Returns polygons for indepdendent states only (default).

Value

A quadratic weights matrix, with the row and column labels containing the country identifiers in the specified coding system (COW or GW).


cshapes documentation built on June 5, 2021, 5:06 p.m.

Related to distmatrix in cshapes...