Learn R Programming

igoR (version 0.2.1)

igo_recode_igoyear: Helper functions to recode categories

Description

These functions convert the numerical code of igo_year_format3 and state_year_format3 into factors.

  • igo_recode_igoyear() is intended to work with values on igo_year_format3.

  • igo_recode_stateyear() is intended to work with values on state_year_format3.

  • igo_recode_dyadic() is intended to work with values on igo_dyadic().

Usage

igo_recode_igoyear(x)

igo_recode_stateyear(x)

igo_recode_dyadic(x)

Value

The recoded values as factors.

Arguments

x

Numerical value (or vector of values) to recode.

See Also

Other datasets: igo_year_format3, state_year_format3, states2016

Examples

Run this code
data("igo_year_format3")

# Recode memberships for some countries

library(dplyr)

samp <- igo_year_format3 %>%
  select(ioname:year, spain, france) %>%
  filter(year > 2000) %>%
  as_tibble()

glimpse(samp)

# Recode
samp %>%
  mutate(
    spain = igo_recode_igoyear(spain),
    france = igo_recode_igoyear(france)
  ) %>%
  glimpse()

Run the code above in your browser using DataLab