check_country_overlap: This function perform some check on the data

View source: R/check_country_overlap.R

check_country_overlapR Documentation

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

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")

FAOSTAT documentation built on March 31, 2023, 8:31 p.m.