Provide an application of the data frames obtained by the main function, harmonize_cn8
. To use these additional functions, data on firm-level is required, which is data that is not provided by the package.
utilize_cn8(b, e, firm_data, harmonized_data = NULL,
progress = TRUE, output = "merged.firm.data",
value = FALSE, base = "CN8")
Provides two possible data frames:
One dataframe that contains all changed CN8 product codes per firm per year. In more detail, this means how many products remained the same, were added or dropped - the value of the same/added/dropped products - how many products were produced by a certain firm in a given year, and how many products were produced in the year after. As a base of this computation CN8plus codes or HS6plus codes can be used.
One dataframe that is based on the entered firm data. The entered firm data is extended by harmonized data (that is "CN8plus", "flag", "flagyear", "HS6plus", "BEC", "BEC_agr", "SNA_basic_class").
Table that summarizes the output, described by the notation (a) above:
Variable | Explanation |
firmID | character; specific code that describes a firm over the years (this code does not change over time) |
period_UL | character; lower limit of the time period |
period | character; time period in which the product was produced |
gap | numeric; indicating if the time period is greater than one (i.e. upper limit - lower limit > 1) |
same_products | numeric; number of products that were produced in both years (i.e. remained in the product portfolio of this firm) |
value_same_products | numeric; value of products that were produced in both years (i.e. remained in the product portfolio of this firm); the value is calculated in the upper limit of the time period |
new_products | numeric; number of added products in the upper limit of the time period (i.e. added to the product portfolio of this firm) |
value_new_products | numeric; value of added products in the upper limit of the time period (i.e. added to the product portfolio of this firm) |
dropped_products | numeric; number of dropped products in the upper limit of the time period (i.e. removed of the product portfolio of this firm) |
value_dropped_products | numeric; value of dropped products in the upper limit of the time period (i.e. removed of the product portfolio of this firm); the value is calculated in the lower limit of the time period |
nbr_of_products_period_LL | numeric; number of all products produced in the lower limit of the time period (i.e. entire product portfolio of this firm) |
nbr_of_products_period_UL | numeric; number of all products produced in the upper limit of the time period (i.e. entire product portfolio of this firm) |
Table that summarizes the output, described by the notation (b) above:
Variable | Explanation |
firmID | character; specific code that describes a firm over the years (this code does not change over time, provided by user) |
year | numeric; year in which the firm produced a product (provided by user) |
CN8 | character; CN8 code of firm product (provided by user) |
(value) | numeric; value of the corresponding product code (may be provided by user) |
... | character; additional columns from original firm data (provided by user) |
CN8plus | character; final harmonization, which refers to the last year of the time period |
flag | numeric; integer from 0 to 3; 1 indicates that this code remained the same in notation over the whole time period but was split or merged in addition; 2 indicates that this code is either new or was dropped during the period of interest; 3 indicates the code had at least one simple change, but is not associated with a family |
flagyear | numeric; indicates the first year in which the flag was set |
HS6 | character; provides the HS6 classification of the CN8plus code |
HS6plus | character; also adjusts for the change lists of HS6 |
BEC | character; provides the BEC classification on a high aggregated level (1 digit) |
BEC_agr | character; provides the BEC classification on a less aggregated level (up to 3 digits) |
SNA | character; provides information if the code is classified as consumption, capital or intermediate good in BEC |
first year of interest
last year of interest
Data on firm level which must provide the following columns: "firmID", "year" and "CN8".
Harmonized data of CN8 product codes. Provided by harmonize_cn8(). By default NULL; the function computes the needed harmonized data.
logical, determines whether progress is printed in console or not.
Defines which dataframe is returned. It may take the following values:
"product.changes", returns all changed CN8 product codes per firm per year (see description of (a) below)
"merged.firm.data", returns entered firm data, extended by harmonized data (see description of (b) below)
"all", returns both dataframes as a list
logical, determines whether value is calculated for same/new/dropped products. Only possible if data contains a column: "value". Value may contain different quantities (e.g. sales [Euro] or weight [kg]).
Defines which plus-codes are used as a base for calculating added/dropped/same products and their corresponding values. It may take the following values:
"CN8", uses CN8plus codes for computation.
"HS6", uses HS6plus codes for computation.
# \donttest{
sampledata <- read.table(paste0(system.file("extdata", package = "harmonizer"),
"/sampledata/cn8sample.txt"), sep = ";",
header = TRUE, colClasses = "character")
newdata <- utilize_cn8(b = 2008, e = 2010, firm_data = sampledata)
newdata <- utilize_cn8(b = 2008, e = 2010, firm_data = sampledata,
output = "all")
changes <- newdata[[1]]
merged_data <- newdata[[2]]
# }
Run the code above in your browser using DataLab