Title: | The CShapes 2.0 Dataset and Utilities |
---|---|
Description: | Package for CShapes 2.0, a GIS dataset of country borders (1886-today). Includes functions for data extraction and the computation of distance matrices and -lists. |
Authors: | Nils B. Weidmann [aut], Guy Schvitz [aut], Luc Girardin [aut, cre] |
Maintainer: | Luc Girardin <[email protected]> |
License: | GPL (>= 2) |
Version: | 2.0 |
Built: | 2025-02-08 04:07:28 UTC |
Source: | https://github.com/cran/cshapes |
Access the CShapes dataset in R
cshp(date = NA, useGW = TRUE, dependencies = FALSE)
cshp(date = NA, useGW = TRUE, dependencies = FALSE)
date |
The date for which the cshapes polygons should be extracted. This argument must be of type Date and must be in the range 1/1/1886 - end of the dataset. If omitted, the complete dataset is returned. |
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). |
A sf
dataframe containing the complete CShapes dataset, or the CShapes snapshot for the specified date.
This function returns between-country distances in km for the given date. Output format is a dataframe 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.
Note that the function returns directed dyads. For example, if there is a country with code 1 and a country with code 2, the resulting data frame contains the dyads (1,2), (2,1), (1,1) and (2,2).
distlist( date, type = "mindist", keep = 0.1, useGW = TRUE, dependencies = FALSE )
distlist( date, type = "mindist", keep = 0.1, useGW = TRUE, dependencies = FALSE )
date |
The date for which the distance list 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 list: "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). |
A datafarame with the columns ccode1 and ccode2 containing the country identifiers in the specified coding system (COW or GW).
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.
distmatrix( date, type = "mindist", keep = 0.1, useGW = TRUE, dependencies = FALSE )
distmatrix( date, type = "mindist", keep = 0.1, useGW = TRUE, dependencies = FALSE )
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). |
A quadratic weights matrix, with the row and column labels containing the country identifiers in the specified coding system (COW or GW).