Distance to nearest UCDP GED event within each country
Source:R/data_ucdp.R
ucdpged_distance_within_country.RdFor each PRIO-GRID cell, computes the distance (in meters) to the nearest
UCDP GED conflict event that occurred within the same country during the
period containing measurement_date. Cells in countries with no
recorded events are set to NA (not 0), to distinguish absence of events
from proximity to events. Events with spatial precision code >= 6
(national-level or coarser) are excluded.
Usage
ucdpged_distance_within_country(
measurement_date,
ged = read_ucdp_ged(),
cshp = read_cshapes(),
config = pg_current_config(),
geodesic = NULL
)Arguments
- measurement_date
A single
Dateobject specifying the measurement date.- ged
An
sfobject containing UCDP GED data. Defaults toread_ucdp_ged().- cshp
An
sfobject containing CShapes 2.0 boundary data. Defaults toread_cshapes().- config
A
pg_configobject. Defaults topg_current_config().- geodesic
Logical or NULL. If TRUE, computes distances in WGS84 using spherical (S2) geometry and reprojects the result to the config CRS. If FALSE, uses Euclidean distances in the config CRS. Default NULL auto-detects: geodesic for projected CRS (e.g. UTM), native for geographic CRS (e.g. WGS84, which terra already handles geodesically).
Value
A SpatRaster with distances in meters to the nearest conflict event
within the same country. NA indicates no events recorded in that country for
the period.
See also
ucdp_ged for fatality-count rasters,
read_ucdp_ged for loading raw UCDP GED data