Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In ct_search, Unexpected Results when Passing "total" to arg commod_codes #7

Closed
ChrisMuir opened this issue Jan 20, 2018 · 1 comment

Comments

@ChrisMuir
Copy link
Member

Example, showing the current issue:

comtradr::ct_update_databases(commodity_type = "EB02")
vals <- ct_search(reporters = "USA", 
                  partners = "World", 
                  freq = "annual", 
                  start_date = "2015-01-01", 
                  end_date = "2015-12-31", 
                  commod_codes = "TOTAL", 
                  type = "services")
nrow(vals)
#> 0

This query should return a data frame with two rows, not 0.

In ct_search, the default value for the commodity codes arg is "TOTAL", which is meant to mean "all commodities". In the guts of ct_search, the literal string "TOTAL" ends up getting used within the query url ... this works for all of the different "HS" commodity schemes, however for EB02, "TOTAL - all services" has an actual commodity code of 200.

To fix this within ct_search, when "all" or "total" is passed as input to arg commod_codes, I'll have a step that actually looks up the code for either in the current commodity codes db on file.

This issue first came up in #5.

@ChrisMuir
Copy link
Member Author

Fixed via commit cd25402.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant