Time periods in data of CBS are coded: yyyyXXww (e.g. 2018JJ00, 2018MM10, 2018KW02),
which contains year (yyyy), type (XX) and index (ww). cbs_add_date_column
converts
these codes into a Date
or numeric
. In addition it adds
a frequency column denoting the type of the column.
cbs_add_date_column(x, date_type = c("Date", "numeric"), ...)
data.frame
retrieved using cbs_get_data
Type of date column: "Date", "numeric. Numeric creates a fractional
number which signs the "middle" of the period. e.g. 2018JJ00 -> 2018.5 and
2018KW01 -> 2018.167. This is for the following reasons: otherwise 2018.0 could mean
2018, 2018 Q1 or 2018 Jan, and furthermore 2018.75 is a bit strange for 2018 Q4.
If all codes in the dataset have frequency "Y" the numeric output will be integer
.
future use.
original dataset with two added columns: <period>_date
and
<period>_freq
. This last column is a factor with levels: Y
, Q
and M