Skip to content

Commit

Permalink
fix error, that B4 classification was wrongly coded under services in…
Browse files Browse the repository at this point in the history
…stead of goods
  • Loading branch information
datapumpernickel committed Nov 17, 2023
1 parent 0a9c660 commit 2ba899a
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions R/ct_check_params.R
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ check_freq <- function(type, frequency) {
#'
#' @noRd
check_clCode <- function(type,commodity_classification) {
cmd_list_goods <- c('HS','S1','S2','S3','S4','SS')
cmd_list_services <- c('B4','B5','EB02','EB10','EB10S','EB')
cmd_list_goods <- c('HS','S1','S2','S3','S4','SS',"B4","B5")
cmd_list_services <- c('EB02','EB10','EB10S','EB')
if(type == 'C'){
rlang::arg_match(commodity_classification, values = cmd_list_goods)
} else {
Expand Down
2 changes: 1 addition & 1 deletion R/ct_get_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#'
#' @param frequency The frequency of returned trade data. Possible values: 'A' for annual data, 'M' for monthly data. Default: 'A'.
#' @param type The type of returned trade data. Possible values: 'goods' for trade in goods, 'services' for trade in services. Default: 'goods'.
#' @param commodity_classification The trade classification scheme. Possible values for goods: `c('HS','S1','S2','S3','S4','SS')`; for services: `c('B4','B5','EB02','EB10','EB10S','EB')`. Default: 'HS'.
#' @param commodity_classification The trade classification scheme. Possible values for goods: `c('HS','S1','S2','S3','S4','SS','B4','B5')`; for services: `c('EB02','EB10','EB10S','EB')`. Default: 'HS'.
#' @param commodity_code The commodity code(s) or `NULL`. See `comtradr::ct_get_ref_table('HS')` for possible values. Default: 'TOTAL' (sum of all commodities).
#' @param flow_direction The direction of trade flows or `NULL`. Possible values: 'import', 'export', 're-import', 're-export', 'all'. Default: 'all'.
#' @param reporter Reporter ISO3 code(s) or `NULL`. See `comtradr::country_codes` for possible values. Default: 'all'.
Expand Down
2 changes: 1 addition & 1 deletion man/ct_check_params.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/ct_commodity_lookup.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/ct_get_data.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/testthat/test-ct_check_parameters.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ test_that("check_freq returns correct frequency codes and handles invalid inputs
# Test 'check_clCode' function
test_that("check_clCode returns correct classification codes and handles invalid inputs", {
expect_equal(check_clCode("C", "HS"), "HS")
expect_equal(check_clCode("S", "B4"), "B4")
expect_equal(check_clCode("C", "B4"), "B4")
expect_error(check_clCode("C", "ISIC"), "`commodity_classification` must be one of")
expect_error(check_clCode("S", "HS"), "`commodity_classification` must be one of")
})
Expand Down

0 comments on commit 2ba899a

Please sign in to comment.