The data
argument should be a data frame produced by sp_get_table()
If this is true, the period_column
argument is not needed.
The codelist
argument, if a data frame, should be a data frame produced by
sp_get_codelist()
. Specifically, it assumes it contains the following columns:
#' You can usually tell which codelist you need from the name of the column whose code you
are looking to expand, e.g. the codes in column paragraf can be expanded by codelist paragraf.
The function filters the codelist to obtain a set of entries relevant to the time period of data
.
If data
contains tables for multiple periods, this is handled appropriately.
Codelist-originating columns in the resulting data frame are renamed so they do not interfere with
joining additional codelists, perhaps in a single pipe call.
Note that some codelists are "secondary" and can only be joined onto other codelists.
If a codelist does not join using sp_add_codelis()
, store the output of sp_get_codelist()
and join
it manually using dplyr
.