Get data on export from and import to Indonesia.
bps_hs_code()
retrieves the Harmonized System (HS) code table. This table contains the HS chapters and codes, which are needed to request trade databps_get_trade_hs_chapter()
requests export or import data by the HS chapter or the first two digits of the HS codebps_get_trade_hs_full()
requests export or import data by the HS codebps_guess_latest_trade_year()
gives the estimated year in which the most recent data are available
Arguments
- hs_chapter, hs_code
The HS chapter or code. To request by multiple chapters or codes, supply a vector of them.
- flow
The trade flow or direction. Must be either "export" or "import".
- year
The year of observation. Defaults to
bps_guess_latest_trade_year()
, which will try to guess the year in which the latest observations are available.Set to
Inf
to request data across all years.To request by multiple years, supply a vector of the years. See the Scope section below for more details.
- freq
The frequency of observation. Must be either "monthly" or "annual". Defaults to "monthly".
Value
bps_hs_code()
returns a tibble containing the HS chapters and codes, as well as their description.bps_get_trade_hs_chapter()
andbps_get_trade_hs_full()
return a tibble with thebpsr_tbl
subclass, which has ametadata
attribtue. Usebps_metadata()
to read it.bps_guess_latest_trade_year()
returns an integer.
Examples
# Request by the HS chapter
bps_get_trade_hs_chapter("03", "export", year = 2018)
#> # A tibble: 3,844 × 8
#> hs_chapter description port partner year month net_weight export
#> <chr> <chr> <chr> <chr> <int> <int> <dbl> <dbl>
#> 1 03 Ikan dan krustasea, m… ACHM… AUSTRA… 2018 9 2 5
#> 2 03 Ikan dan krustasea, m… ACHM… AUSTRA… 2018 10 6.84 27.1
#> 3 03 Ikan dan krustasea, m… ACHM… HONG K… 2018 1 100 130
#> 4 03 Ikan dan krustasea, m… ACHM… HONG K… 2018 7 31 40
#> 5 03 Ikan dan krustasea, m… ACHM… HONG K… 2018 12 10 5
#> 6 03 Ikan dan krustasea, m… ACHM… JAPAN 2018 1 7.3 72.9
#> 7 03 Ikan dan krustasea, m… ACHM… JAPAN 2018 2 14.6 119.
#> 8 03 Ikan dan krustasea, m… ACHM… JAPAN 2018 3 18.6 163.
#> 9 03 Ikan dan krustasea, m… ACHM… JAPAN 2018 4 8.20 43.7
#> 10 03 Ikan dan krustasea, m… ACHM… JAPAN 2018 5 659 7452.
#> # ℹ 3,834 more rows
#> # ℹ Read the metadata with `bps_metadata()`