-
Notifications
You must be signed in to change notification settings - Fork 17
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
Error code [400] when downloading dataset from comtrade #24
Comments
Hey, so there's a few things going on here. The API call is returning ct_commodity_lookup("motor vehicle", return_code = FALSE, return_char = TRUE)[1]
If you're passing commodity codes along to API calls, you'll want to use ct_commodity_lookup("motor vehicle", return_code = TRUE, return_char = TRUE)
Doing this will alleviate the #Find all the codes associated with "motor vechicle"
auto_codes <- ct_commodity_lookup("motor vehicle",
return_code = TRUE,
return_char = TRUE)
##Download the data for trade in these codes (motor vechicles)
auto_trade<- ct_search(reporters = "All",
partners = "All",
trade_direction = "imports",
start_date = "2016-01-01",
end_date = "2016-12-31",
commod_codes = auto_codes)
The issue here is that the catch-all input I appreciate you bringing this to my attention though, I think I'm going to add a check to |
Pushed a commit last night (137ff09) that should handle this a little more gracefully. An error is thrown prior to an api call being made to Comtrade. Thank you again for bringing this up! Here is the output of the code now: library(comtradr)
#Find all the codes associated with "motor vechicle"
auto_codes <- ct_commodity_lookup("motor vehicle",
return_code = FALSE,
return_char = TRUE)
##Download the data for trade in these codes (motor vechicles)
auto_trade<- ct_search(reporters = "All",
partners = "All",
trade_direction = "imports",
start_date = "2016-01-01",
end_date = "2016-12-31",
commod_codes = auto_codes)
|
I have used the example code from
https://rpubs.com/matt_smith/ITNr
When I run this I get the error code
Error: Comtrade API request failed, with status code [400]
Any idea why this doesn't work?
The text was updated successfully, but these errors were encountered: