Learn R Programming

FAOSTAT (version 2.2.1)

FAOcheck: 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

FAOcheck(
  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
# NOT RUN {
## 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)))
## FAOcheck(var = "Value", data = test.df, type = "overlap", take = "simpleCheck")
## FAOcheck(var = "Value", data = test.df, type = "overlap", take = "takeNew")
## FAOcheck(var = "Value", data = test.df, type = "overlap", take = "takeOld")
## FAOcheck(var = "Value", data = test.df, type = "overlap", take = "complete")
# }

Run the code above in your browser using DataLab