CountryID {psData}R Documentation

Function for creating standardised country names and ID variables

Description

Function for creating standardised country names and ID variables based on capabilities from the countrycode package. The function also reports if duplicated country IDs have been created and lets the user either drop these or return only duplicated values for inspection.

Usage

CountryID(data, countryVar = "country", OutCountryID = "iso2c",
  standardCountryName = TRUE, duplicates = "message", timeVar = NULL,
  fromLast = FALSE)

Arguments

data

a data frame object

countryVar

character string naming the country.name variable. See countrycode.

OutCountryID

character string. The type of country ID you would like to include in the output file along with the country name. See countrycode for available options.

standardCountryName

logical. Whether or not to standardise the country names variable based on country.name from countrycode.

duplicates

character string specifying how to handle duplicated country or country-time observations (for the latter see timeVar). Can be set to none to do nothing, message to simply report duplicates, drop to report and drop duplicates, and return to return a data frame with only duplicated observations (see also fromLast).

timeVar

character string indicating the name of a time variable. For example, country time series often have separate rows based on a year variable. This is used solely to determine if there are duplicated country-time values.

fromLast

logical indicating if duplication should be considered from the reverse side. Only relevant if duplicates = 'drop' or duplicates = 'return'.

See Also

duplicated


[Package psData version 0.2.2 Index]