concord_naics: Concord Within NAICS Codes

concord_naicsR Documentation

Concord Within NAICS Codes

Description

Concords codes within the North American Industry Classification System codes (NAICS2002, NAICS2007, NAICS2012, NAICS2017).

Usage

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

Arguments

sourcevar

An input character vector of NAICS codes. The function accepts 2 to 6-digit NAICS codes.

origin

A string setting the input industry classification: "NAICS2002", "NAICS2007", "NAICS2012", and "NAICS2017".

destination

A string setting the output industry classification: "NAICS2002", "NAICS2007", "NAICS2012", and "NAICS2017".

dest.digit

An integer indicating the preferred number of digits for output codes. Allows 2 to 6-digit NAICS codes. 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.

Source

Concordance tables provided by:

  • United State Census Bureau <https://www.census.gov/eos/www/naics/concordances/concordances.html>

Examples

concord_naics(sourcevar = c("2111", "3352"),
              origin = "NAICS2017", destination = "NAICS2002",
              dest.digit = 6, all = TRUE)
concord_naics(sourcevar = c("2111", "3352"),
              origin = "NAICS2017", destination = "NAICS2007",
              dest.digit = 6, all = TRUE)
concord_naics(sourcevar = c("2111", "3352"),
              origin = "NAICS2017", destination = "NAICS2012",
              dest.digit = 6, all = TRUE)

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