Learn R Programming

FAOSTAT (version 2.4.0)

translate_countrycodes: A function to translate between different country coding systems

Description

The function translate any country code scheme to another if both are in the are among the types present in the FAO API. If you require other codes or conversion of country names to codes, consider the countrycodes package.

Usage

translate_countrycodes(
  data,
  from = c("FAO", "M49", "ISO2", "ISO3"),
  to = c("M49", "FAO", "ISO2", "ISO3", "name"),
  oldCode,
  reset_cache = FALSE
)

translateCountryCode( data, from = c("FAO", "M49", "ISO2", "ISO3"), to = c("M49", "FAO", "ISO2", "ISO3", "name"), oldCode, reset_cache = FALSE )

Arguments

data

The data frame

from

The name of the old coding system

to

The name of the new coding system

oldCode

The column name of the old country coding scheme

reset_cache

logical. Whether to pull data from FAOSTAT directly instead of caching