matchkeys: Match country name with its unique key

Description Usage Arguments Value Examples

Description

Associate to a country its unique identifier necessary to merge dataframes

Usage

1
matchkeys(df_data, df_keys, origin = "FaoStat", countrycol = "area")

Arguments

df_data

Dataframe with a country vector

df_keys

Dataframe where countries are associated to a unique key

origin

In df_keys, which data source should we look at?

countrycol

Column name of the variable where countries can be found in df_data

Value

A dataframe with unique id keys

Examples

1
2
3
4
5
6
7
8
## Not run: 
codes <- readxl::read_excel(path = paste0(datadir,"/creation_zonier.xls"),
sheet = "Transco_Country")
# MAPPING IDs TO THEIR VALUES
df_FAO = matchkeys(df_FAO,codes)
df_WB = matchkeys(df_WB,codes,origin = "World Bank")
df_ILO = matchkeys(df_ILO,codes, origin = "IloStat")
## End(Not run)

EpidemiumOpenCancer/OpenCancer documentation built on May 12, 2019, 7:46 a.m.