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
Closed

Comments

@ChrisMuir
Copy link
Member

@ChrisMuir ChrisMuir commented Jan 20, 2018

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

@ChrisMuir ChrisMuir commented Jan 20, 2018

Fixed via commit cd25402.

@ChrisMuir ChrisMuir closed this Jan 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.