Learn R Programming

FAOSTAT (version 2.4.0)

check_country_overlap: This function perform some check on the data

Description

The function only works for FAOST_CODE. If the country coding system is not in FAOST_CODE then use the translateCountryCode function to translate it.

Usage

check_country_overlap(
  var,
  year = "Year",
  data,
  type = c("overlap", "multiChina"),
  take = c("simpleCheck", "takeNew", "takeOld", "complete")
)

Arguments

var

The variable to be checked.

year

The column which index the time.

data

The data frame.

type

The type of check.

take

The type of check/replacement to be done in case of type equals to overlap.

Examples

Run this code
test.df = 
   data.frame(FAOST_CODE = rep(c(51,167,199), each = 3), 
  Year = rep(c(1990:1992), 3),
  Value = c(c(3,4,4), c(2,2,2), c(1,2,NA)))
check_country_overlap(var = "Value", data = test.df, type = "overlap", take = "simpleCheck")
check_country_overlap(var = "Value", data = test.df, type = "overlap", take = "takeNew")
check_country_overlap(var = "Value", data = test.df, type = "overlap", take = "takeOld")
check_country_overlap(var = "Value", data = test.df, type = "overlap", take = "complete")

Run the code above in your browser using DataLab