concord: Concording Different Classification Codes

concordR Documentation

Concording Different Classification Codes

Description

Concords different classification codes used in international trade.

Usage

concord(sourcevar, origin, destination, dest.digit = 4, all = FALSE)

Arguments

sourcevar

An input character vector of industry/product codes to be converted.

origin

A string setting the input coding scheme. Currently supports: "HS0" (1988/92), "HS1" (1996), "HS2" (2002), "HS3" (2007), "HS4" (2012), "HS5" (2017), "HS" (combined), "SITC1" (1950), "SITC2" (1974), "SITC3" (1985), "SITC4" (2006), "NAICS2002", "NAICS2007", "NAICS2012", "NAICS2017", "NAICS" (combined), "ISIC2" (1968), "ISIC3" (1989), "ISIC3.1" (2002), "ISIC4" (2008), "BEC4" (2016).

destination

A string setting the output coding scheme. Currently supports: "HS0" (1988/92), "HS1" (1996), "HS2" (2002), "HS3" (2007), "HS4" (2012), "HS5" (2017), "HS" (combined), "SITC1" (1950), "SITC2" (1974), "SITC3" (1985), "SITC4" (2006), "NAICS2002", "NAICS2007", "NAICS2012", "NAICS2017", "NAICS" (combined), "ISIC2" (1968), "ISIC3" (1989), "ISIC3.1" (2002), "ISIC4" (2008), "BEC4" (2016).

dest.digit

An integer indicating the preferred number of digits for outputs. The default is 4 digits.

all

Either TRUE or FALSE. If TRUE, the function will return (1) all matched outputs for each input, and (2) the share of occurrences for each matched output among all matched outputs. Users can use the shares as weights for more precise concordances. If FALSE, the function will only return the matched output with the largest share of occurrences (the mode match). If the mode consists of multiple matches, the function will return the first matched output.

Value

The matched output(s) for each element of the input vector. Either a list object when all = TRUE or a character vector when all = FALSE.

Note

Please include leading zeros in codes (e.g., use HS code 010110 instead of 10110). For BEC4 only, use original codes or add trailing zeroes if necessary (e.g., 7 or 700 instead of 007). Results may be buggy otherwise.

Source

Data consolidated from

  • Pierce and Schott (2009, 2018) <https://faculty.som.yale.edu/peterschott/international-trade-data/>

  • World Integrated Trade Solution (WITS), World Bank <https://wits.worldbank.org/product_concordance.html>

  • United Nations Trade Statistics <https://unstats.un.org/unsd/trade/classifications/correspondence-tables.asp>

Examples

# HS to NAICS
concord(sourcevar = c("120600", "854690"),
        origin = "HS", destination = "NAICS",
        dest.digit = 6, all = TRUE)
concord(sourcevar = c("120600", "854690"),
        origin = "HS", destination = "NAICS",
        dest.digit = 6, all = FALSE)

# NAICS to HS
concord(sourcevar = c("111120", "326199"),
        origin = "NAICS", destination = "HS",
        dest.digit = 6, all = TRUE)

# HS to SITC4
concord(sourcevar = c("120600", "854690"),
        origin = "HS", destination = "SITC4",
        dest.digit = 5, all = TRUE)

# SITC4 to HS
concord(sourcevar = c("22240", "77324"),
        origin = "SITC4", destination = "HS",
        dest.digit = 6, all = TRUE)

# HS to ISIC3
concord(sourcevar = c("120600", "854690"),
        origin = "HS", destination = "ISIC3",
        dest.digit = 4, all = TRUE)

# SITC4 to NAICS
concord(sourcevar = c("22240", "77324"),
        origin = "SITC4", destination = "NAICS",
        dest.digit = 6, all = TRUE)

# NAICS to SITC4
concord(sourcevar = c("111120", "326199"),
        origin = "NAICS", destination = "SITC4",
        dest.digit = 5, all = TRUE)

# BEC4 to NAICS2017
concord(sourcevar = c("11", "21"), 
        origin = "BEC4", destination = "NAICS2017", 
        dest.digit = 4, all = FALSE)

insongkim/concordance documentation built on Jan. 25, 2023, 4:55 p.m.