Adds a date
variable to a BPS dataset, based on years and period IDs or
numeric representations of months. The values are the floor date of the
given period. The format is year-month-date (ymd).
See also
bps_get_dataset()
andbps_get_datasets()
to request datasets.bps_get_trade_hs_chapter()
andbps_get_trade_hs_full()
to request trade datasets.
Examples
data <- bps_get_trade_hs_chapter("01", "export", year = 2021)
bps_add_date(data)
#> # A tibble: 338 × 9
#> hs_chapter description port partner year month date net_weight export
#> <chr> <chr> <chr> <chr> <int> <int> <date> <dbl> <dbl>
#> 1 01 Binatang h… ATAP… EAST T… 2021 2 2021-02-01 3494. 45808
#> 2 01 Binatang h… ATAP… EAST T… 2021 4 2021-04-01 1524. 19790
#> 3 01 Binatang h… ATAP… EAST T… 2021 5 2021-05-01 1974. 25465
#> 4 01 Binatang h… ATAP… EAST T… 2021 6 2021-06-01 923. 11825
#> 5 01 Binatang h… ATAP… EAST T… 2021 7 2021-07-01 536. 6930
#> 6 01 Binatang h… ATAP… EAST T… 2021 8 2021-08-01 553. 6890
#> 7 01 Binatang h… ATAP… EAST T… 2021 9 2021-09-01 2514. 31955
#> 8 01 Binatang h… ATAP… EAST T… 2021 11 2021-11-01 2852. 38133
#> 9 01 Binatang h… ATAP… EAST T… 2021 12 2021-12-01 667. 11350
#> 10 01 Binatang h… KUAL… JAPAN 2021 4 2021-04-01 5 103.
#> # ℹ 328 more rows
#> # ℹ Read the metadata with `bps_metadata()`