Build the firm-year analytical panel and its derived indicators
Source:R/build-accounts-indicators.R
build_accounts_indicators.RdCleans the raw firm-level panel, optionally folds in establishment-level plant data, and constructs every derived variable the other 4 pipeline stages depend on: growth rates, high-growth-firm (HGF) flags, age/size/sector/region categories, the TL3 urbanisation typology, labour productivity, multi-factor productivity (Solow residual), and the acquisition indicator.
Usage
build_accounts_indicators(
config,
base_financials,
plants_raw = NULL,
exchange_rates = NULL,
tl3_typology = NULL,
storage_types = NULL
)Arguments
- config
A
scaleup_configfromconfig_scaleup().- base_financials
A data frame of raw firm-level financials, as described in variable_dictionary and
vignette("input-data"). Must containidf, year, sector_1d, sector_2d, sector_3d, employment, turnover, region_2d; every other column is optional and used only if present.- plants_raw
Optional data frame of establishment-level data (
plants_RAWin variable_dictionary), with columnsidf, idp, year. IfNULL(the default), nomultiplantindicator is produced.- exchange_rates
Optional data frame with columns
year, country, rate, used for the non-euro countries incountry_patches$non_euro.NULL(the default) uses the package's exchange_rates.- tl3_typology
Optional data frame with columns
region_3d, typology_access_cities(andclassification, to selectconfig$tl_classification), used whenbase_financialshas aregion_3dcolumn.NULL(the default) uses the package's tl3_typology.- storage_types
Optional named character vector giving the storage type (
"byte","int","long","float","double") of the columns ofbase_financials, as stored in its.dtafile.run_scaleup_pipeline()reads it from the file header. Afloat(orbyte/int) variable rescaled to EUR thousand is rounded to single precision, as the file stores it.NULL(the default) treats every column asdouble.
Value
A data frame, one row per (idf, year), ready to be passed to
compute_characteristics(), compute_persistence(),
compute_contribution(), and compute_predictors().
Details
This is a pure function: it takes already-loaded data frames and returns
the built panel (run_scaleup_pipeline() reads and writes the files).
Lags and leads are taken by (idf, year), not by row position, so a gap
in a firm's years gives a missing value.