icews_to_gwcode: Translate country to G&W country codes

View source: R/data-processing.R

icews_to_gwcodeR Documentation

Translate country to G&W country codes

Description

Translate country names to Gleditsch & Ward country codes.

Usage

icews_to_gwcode(country, date)

Arguments

country

The character country name in ICEWS

date

Event date; some countries like Yugoslavia/Serbia and Montenegro/Serbia change over time.

Examples

# Territories are correctly associated with metropole
df <- dplyr::tibble(
  country = c("United States", "Puerto Rico", "Guam"),
  event_date = rep(as.Date("2018-01-01")),
  stringsAsFactors = FALSE)
df$gwcode <- icews_to_gwcode(df$country, df$event_date)
df

# Time-varying translation
df <- dplyr::tibble(
  country = c("Serbia", "Serbia"),
  event_date = as.Date(c("2006-06-04", "2006-06-05")),
  stringsAsFactors = FALSE)
df$gwcode <- icews_to_gwcode(df$country, df$event_date)
df

andybega/icews documentation built on July 7, 2023, 1:29 p.m.