updateCorrespondenceTable {correspondenceTables}R Documentation

Update the correspondence table between statistical classifications A and B when A has been updated to version A*

Description

Update the correspondence table between statistical classifications A and B when A has been updated to version A*.

Usage

updateCorrespondenceTable(
  A,
  B,
  AStar,
  AB,
  AAStar,
  CSVout = NULL,
  Reference = "none",
  MismatchToleranceB = 0.2,
  MismatchToleranceAStar = 0.2
)

Arguments

A

A string of the type character containing the name of a csv file that contains the original classification A.

B

A string of the type character containing the name of a csv file that contains classification B.

AStar

A string of the type character containing the name of a csv file that contains the updated version A*.

AB

A string of the type character containing the name of a csv file that contains the previous correspondence table A:B.

AAStar

A string of the type character containing the name of a csv file that contains the concordance table A:A*, which contains the mapping between the codes of the two versions of the classification.

CSVout

The preferred name for the output csv files that will contain the updated correspondence table and information about the classifications involved. The valid values are NULL or strings of type character. If the selected value is NULL, the default, no output file is produced. If the value is a string, then the output is exported into two csv files whose names contain the provided name (see "Value" below).

Reference

The reference classification among A and B. If a classification is the reference to the other, and hence hierarchically superior to it, each code of the other classification is expected to be mapped to at most one code of the reference classification. The valid values are "none", "A", and "B". If the selected value is "A" or "B", a "Review" flag column is included in the output (see "Explanation of the flags" below).

MismatchToleranceB

The maximum acceptable proportion of rows in the updated correspondence table which contain no code of the target classification B, among those which contain a code of A, of A*, or of both. The default value is 0.2. The valid values are real numbers in the interval [0, 1].

MismatchToleranceAStar

The maximum acceptable proportion of rows in the updated correspondence table which contain no code of the updated classification A*, among those which contain a code of A, of B, or of both. The default value is 0.2. The valid values are real numbers in the interval [0, 1].

Details

File and file name requirements:

Classification table requirements:

Correspondence and concordance table requirements:

Interdependency requirements:

Mismatch tolerance:

If any of the conditions required from the arguments is violated an error message is produced and execution is stopped.

Value

updateCorrespondenceTable() returns a list with two elements, both of which are data frames.

Explanation of the flags

Sample datasets included in the package

Running browseVignettes("correspondenceTables") in the console opens an html page in the user's default browser. Selecting HTML from the menu, users can read information about the use of the sample datasets that are included in the package. If they wish to access the csv files with the sample data, users have two options:

Examples

 {
 ## Application of function updateCorrespondenceTable() with NAICS 2017 being the
 ## original classification A, NACE being the target classification B, NAICS 2022
 ## being the updated version A*, NAICS 2017:NACE being the previous correspondence
 ## table A:B, and NAICS 2017:NAICS 2022 being the A:A* concordance table. The desired
 ## name for the csv file that will contain the updated correspondence table is
 ## "updateCorrespondenceTable.csv", there is no reference classification, and the
 ## maximum acceptable proportions of unmatched codes between the original
 ## classification A and the target classification B, and between the original
 ## classification A and the updated classification A* are 0.5 and 0.3, respectively.
  
 tmp_dir<-tempdir()   
 A <- system.file("extdata", "NAICS2017.csv", package = "correspondenceTables")
 AStar <- system.file("extdata", "NAICS2022.csv", package = "correspondenceTables")
 B <- system.file("extdata", "NACE.csv", package = "correspondenceTables")
 AB <- system.file("extdata", "NAICS2017_NACE.csv", package = "correspondenceTables")
 AAStar <- system.file("extdata", "NAICS2017_NAICS2022.csv", package = "correspondenceTables")
 
 UPC <- updateCorrespondenceTable(A,
                                  B,
                                  AStar, 
                                  AB, 
                                  AAStar, 
                                  file.path(tmp_dir,"updateCorrespondenceTable.csv"), 
                                  "none", 
                                  0.5, 
                                  0.3)
 
 summary(UPC)
 head(UPC$updateCorrespondenceTable)
 UPC$classificationNames
 csv_files<-list.files(tmp_dir, pattern = ".csv")
 if (length(csv_files)>0) unlink(csv_files)
    }

[Package correspondenceTables version 0.7.4 Index]