combine_GVA: Combine GVA, ABS, SIC91, and Tourism datasets

Description Usage Arguments Details Value Examples

Description

Combines datasets exracted from the underlying spreadsheet using the extract_XXX functions. A notebook version of this function (which may be easier to debug) can be downloaded using the get_GV_combine() function. Note that this function in its current form will only work to reproduce the 2016 SFR, and requires adjustment to generalise it over new years.

NOTE: THIS FUNCTION RELIES ON DATA WHICH ARE CLASSIFIED AS OFFICIAL-SENSITIVE. THE OUTPUT OF THIS FUNCTION IS AGGREGATED, AND PUBLICALLY AVAILABLE IN THE FINAL STATISTICAL RELEASE, HOWEVER CARE MUST BE EXERCISED WHEN CREATING A PIPELINE INCLUDING THIS FUNCTION. IT IS HIGHLY ADVISEABLE TO ENSURE THAT THE DATA WHICH ARE CREATED BY THE extract_ FUNCTIONS ARE NOT STORED IN A FOLDER WHICH IS A GITHUB REPOSITORY TO MITIGATE AGAINST ACCIDENTAL COMMITTING OF OFFICIAL DATA TO GITHUB. TOOLS TO FURTHER HELP MITIGATE THIS RISK ARE AVAILABLE AT https://github.com/ukgovdatascience/dotfiles.

Usage

1
2
3
combine_GVA(ABS = NULL, GVA = NULL, SIC91 = NULL,
  DCMS_sectors = eesectors::DCMS_sectors, tourism = NULL,
  log_level = futile.logger::INFO, log_appender = "console")

Arguments

ABS

ABS data as extracted by eesectors::extract_ABS_data().

GVA

ABS data as extracted by eesectors::extract_GVA_data().

SIC91

ABS data as extracted by eesectors::extract_SIC91_data().

DCMS_sectors

ABS data as extracted by eesectors::extract_DCMS_sectors() or matching the eesectors::DCMS_sectors in-built dataset.

tourism

ABS data as extracted by eesectors::extract_tourism_data().

log_level

The severity level at which log messages are written from least to most serious: TRACE, DEBUG, INFO, WARN, ERROR, FATAL. Default is level is INFO. See ?flog.threshold() for additional details.

log_appender

Defaults to write the log to "console", alternatively you can provide a character string to specify a filename to also write to. See for additional details ?futile.logger::appender.file().

Details

The best way to understand what happens when you run this function is to look at the inst/combine_GVA.Rmd notebook, which can be downloaded automatically using the get_GV_combine() function, or by visiting https://github.com/ukgovdatascience/eesectors/blob/master/inst/combine_GVA.Rmd. A brief explanation of what the function does here:

1. Remove SIC 91 data from ABS and swap in values from SIC91) 2. Duplicate the 2014 ABS values to use for 2015 (2015 values not being available - this may change in future years.). 2. Merge the eesectors::DCMS_sectors into ABS to get the 2 digit SIC code. 3. Calculate sums across sectors and years. 4. Add in total UK GVA from GVA. 5. Match in tourism data. 6. Add tourism overlap. 7. Build the dataframe into a format that is expected by the year_sector_data class.

Value

A data.frame as expected by the year_sector_data class. Can also return an error log to console or write to file.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
library(eesectors)

input <- 'OFFICIAL_working_file_dcms_V13.xlsm'

combine_GVA(
  ABS = eesectors::extract_ABS_data(input),
  GVA = eesectors::extract_ABS_data(input),
  SIC91 = eesectors::extract_ABS_data(input),
  DCMS_sectors = eesectors::DCMS_sectors,
  tourism = eesectors::extract_ABS_data(input)
)

## End(Not run)

DCMSstats/eesectors documentation built on May 3, 2019, 2:43 p.m.