-
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
Can't get data for 2017 #12
Comments
That specific query is returning an empty data frame because the Comtrade API doesn't return data for that query. If you go to the Comtrade API query website, plug in your search parameters and hit the "Preview" button, you'll see that there are zero results returned. Comtrade relies on reporting from individual countries to update their DB, so sometimes posting of new data can seem slow. Also, for annual versus monthly data, I believe they hold off on publishing annual data until they've received data for all (most?) months for a given year. For example, this query returns zero results: df <- comtradr::ct_search(reporters = "USA",
partners = "World",
freq = "annual",
start_date = 2017,
end_date = 2017) While this query returns a df with nine observations (one row each for df <- comtradr::ct_search(reporters = "USA",
partners = "World",
freq = "monthly",
start_date = "2017-01",
end_date = "2017-03") |
Thank you. I've failed to realize that. |
No worries! Yeah the ability to pass date args that are not in the format In |
The "all of 'yyyy'" parameter gives all months of that year if the data is set to monthly. Is a parameter under 'Periods' witch makes more viable to create long monthly series since you can search 12 months each time, instead of 5. |
Ahhh, I now see what you're talking about....woah I've never seen the In the meantime, I think you can recreate the # Simulate the "All of 2016" monthly search
library(dplyr)
df <- comtradr::ct_search("USA", "China",
freq = "monthly",
start_date = "all",
end_date = "all") %>%
filter(year == 2016) |
Function So going back to my previous example: # Simulate the "All of 2016" monthly search
library(dplyr)
df <- comtradr::ct_search("USA", "China",
freq = "monthly",
start_date = "all",
end_date = "all") %>%
filter(year == 2016) This query is now equivalent (all monthly data for 2016): df <- comtradr::ct_search("USA", "China",
freq = "monthly",
start_date = 2016,
end_date = 2016) Thanks again @pedromein for bringing this API feature to my attention! |
I'm not able to get data for 2017 on, already updated database. For Exemple
example1 <- ct_search(reporters = "Canada", partners = "Brazil", trade_direction = "exports", start_date = "2017-01-01", end_date = "2018-01-01")
Will return a data frame with no observations.
The text was updated successfully, but these errors were encountered: