Learn R Programming

harmonizer (version 0.3.2)

utilize_pc8: A possible utilization of harmonized PC8 products codes

Description

Provide an application of the data frames obtained by the main function, harmonize_pc8. To use these additional functions, data on firm-level is required, which is data that is not provided by the package.

Usage

utilize_pc8(b, e, firm_data, harmonized_data = NULL,
            progress = TRUE, output = "merged.firm.data",
            value = FALSE, base = "PC8")

Value

Provides two possible data frames:

(a)

One dataframe that contains all changed PC8 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 PC8plus codes or HS6plus codes can be used.

(b)

One dataframe that is based on the entered firm data. The entered firm data is extended by harmonized data (that is "PC8plus", "flag", "flagyear", "HS6plus", "BEC", "BEC_agr", "SNA_basic_class").

Table that summarizes the output, described by the notation (a) above:

VariableExplanation
firmIDcharacter; specific code that describes a firm over the years (this code does not change over time)
period_ULcharacter; lower limit of the time period
periodcharacter; time period in which the product was produced
gapnumeric; indicating if the time period is greater than one (i.e. upper limit - lower limit > 1)
same_productsnumeric; number of products that were produced in both years (i.e. remained in the product portfolio of this firm)
value_same_productsnumeric; 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_productsnumeric; number of added products in the upper limit of the time period (i.e. added to the product portfolio of this firm)
value_new_productsnumeric; value of added products in the upper limit of the time period (i.e. added to the product portfolio of this firm)
dropped_productsnumeric; number of dropped products in the upper limit of the time period (i.e. removed of the product portfolio of this firm)
value_dropped_productsnumeric; 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_LLnumeric; 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_ULnumeric; 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:

VariableExplanation
firmIDcharacter; specific code that describes a firm over the years (this code does not change over time, provided by user)
yearnumeric; year in which the firm produced a product (provided by user)
PC8character; PC8 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)
PC8pluscharacter; final harmonization, which refers to the last year of the time period
flagnumeric; 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
flagyearnumeric; indicates the first year in which the flag was set
HS6character; provides the HS6 classification of the PC8plus code
HS6pluscharacter; also adjusts for the change lists of HS6
BECcharacter; provides the BEC classification on a high aggregated level (1 digit)
BEC_agrcharacter; provides the BEC classification on a less aggregated level (up to 3 digits)
SNAcharacter; provides information if the code is classified as consumption, capital or intermediate good in BEC

Arguments

b

first year of interest

e

last year of interest

firm_data

Data on firm level which must provide the following columns: "firmID", "year" and "PC8".

harmonized_data

Harmonized data of PC8 product codes. Provided by harmonize_pc8(). By default NULL; the function computes the needed harmonized data.

progress

logical, determines whether progress is printed in console or not.

output

Defines which dataframe is returned. It may take the following values:

  • "product.changes", returns all changed PC8 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

value

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]).

base

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:

  • "PC8", uses CN8plus codes for computation.

  • "HS6", uses HS6plus codes for computation.

Examples

Run this code
# \donttest{
sampledata <- read.table(paste0(system.file("extdata", package = "harmonizer"),
                         "/sampledata/pc8sample.txt"), sep = ";",
                         header = TRUE , colClasses = "character")

newdata <- utilize_pc8(b = 2011, e = 2013, firm_data = sampledata)

newdata <- utilize_pc8(b = 2011, e = 2013, firm_data = sampledata,
                       output = "all")
changes <- newdata[[1]]
merged_data <- newdata[[2]]
# }

Run the code above in your browser using DataLab