ropensci / tradestatistics

R package to access Open Trade Statistics API
https://docs.ropensci.org/tradestatistics
Apache License 2.0
76 stars 14 forks source link

Table with distances #71

Closed andreaspacher closed 1 year ago

andreaspacher commented 1 year ago

If I understand ots_tables correctly, one should be able to create a table covering "distances" with ots_create_tidy_data().

For instance, the following code should give me the distance between Japan and Albania, right?

library(tradestatistics)
dist <- ots_create_tidy_data(
  reporters = "jpn",
  partners = "Albania",
  table = "distances"
)

However, using that code, I receive the following messages in my console:

The requested table is included within the package.
Error in rbindlist(data, fill = TRUE) : 
  Item 1 of input is not a data.frame, data.table or list
pachadotdev commented 1 year ago

hi @andreaspacher

there's an error that shouldn't be there, and that is why I'm reversing to re-add tibble as a dependency (data.table has many useful features, but to write things programmatically it's very challenging)

the first line is telling you that tradestatistics::ots_distances already has what you need, and there is no need to download data