distmatrix {cshapes} | R Documentation |
Generate between-country distance matrix on the CShapes dataset
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:
Capital distances
Centroid distances
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
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 |
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).