countryExists: Find if country exists for a given year

Description Usage Arguments Value

Description

Some countries like the former Soviet union or South Sudan dissolve or are formed during the period where we collect data. This function when given a country or a year returns a boolean expressing if the country exists for that year.

Usage

1
countryExists(countries, years, names = FALSE, warnNA = TRUE)

Arguments

countries

vector of countries. Can be either names of M49 codes

years

vector of years, must be same length as countries

names

logical. TRUE when names are given. They must correspond to the descriptions in agriculture:agriculture

warnNA

logical. By default, a warning will be given when an NA is in countries or year. Setting this to FALSE suppresses it.

Value

A vector (TRUE/FALSE) of the same length as countries and year corresponding to if they are a country or not. A warning - if this has NAs, subsetting by an NA can be problematic, i.e. result in no matches when subsetting.


SWS-Methodology/faoswsUtil documentation built on May 9, 2019, 11:53 a.m.