
Retrieve UCDP Dataset from API
cl_get_data.RdThis function retrieves a dataset from the Uppsala Conflict Data Program (UCDP) API. It takes the resource type and version as input parameters, constructs the API request, and returns the combined results of all pages. The function also validates and filters the input parameters based on the specified resource to ensure compatibility with the API.
Usage
cl_get_data(
resource,
version,
country = NULL,
conflict = NULL,
year = NULL,
conflict_incompatibility = NULL,
dyad = NULL,
org = NULL,
conflict_type = NULL,
geography = NULL,
start_date = NULL,
end_date = NULL,
type_of_violence = NULL,
actor = NULL
)Arguments
- resource
A character string specifying the type of resource to request. Must be one of:
"ucdpprioconflict": State-based conflicts data."dyadic": Dyadic-level conflict data."battledeaths": Data on battle-related deaths."nonstate": Non-state conflicts data."onesided": Data on one-sided violence."gedevents": Event-based conflict data from the UCDP GED.
- version
A character string specifying the version of the resource to request.
- country
A vector of numeric country codes (Gleditsch and Ward codes).
Valid for all resources.
Must be a numeric vector, where each code corresponds to a country involved in the conflict.
- conflict
A vector of numeric conflict IDs.
Valid for
"ucdpprioconflict","dyadic","battledeaths", and"nonstate"resources.Not valid for the
"onesided"resource.Must be a numeric vector representing conflict IDs.
- year
A vector of years in YYYY format.
Valid for all resources.
Must be a numeric vector or character vector in the format
"YYYY".
- conflict_incompatibility
A vector of numeric conflict incompatibility codes.
Valid for
"ucdpprioconflict","dyadic", and"battledeaths"resources.Not valid for
"nonstate"and"onesided"resources.Must be a numeric vector representing the type of incompatibility.
- dyad
A vector of numeric dyad IDs.
Valid for
"gedevents","dyadic","battledeaths", and"onesided"resources.Not valid for
"ucdpprioconflict"and"nonstate"resources.Must be a numeric vector representing dyad IDs.
- org
A vector of numeric organization IDs.
Valid only for the
"nonstate"resource.Not valid for
"ucdpprioconflict","dyadic","battledeaths","onesided", and"gedevents"resources.Must be a numeric vector representing organization IDs.
- conflict_type
A vector of numeric conflict type codes.
Valid for
"ucdpprioconflict","dyadic", and"battledeaths"resources.Not valid for
"nonstate","onesided", and"gedevents"resources.Must be a numeric vector representing conflict type codes.
- geography
A string specifying the geographic bounding box in the format "y0 x0,y1 x1".
Valid only for the
"gedevents"resource.Format: Two coordinates describing the bounding box (latitude and longitude).
Example:
"40 -75,41 -73"for New York City.
- start_date
A string specifying the start date in "YYYY-MM-DD" format.
Valid only for the
"gedevents"resource.Must specify the date from which events have definitely happened.
- end_date
A string specifying the end date in "YYYY-MM-DD" format.
Valid only for the
"gedevents"resource.Must specify the date up to which events have definitely happened.
- type_of_violence
A vector of numeric violence type codes.
Valid only for the
"gedevents"resource.Must be a numeric vector representing types of violence.
- actor
A vector of numeric actor IDs.
Valid only for the
"gedevents"resource.Must be a numeric vector representing actor IDs.