rOpenGov / eurostat

R tools for Eurostat data
http://ropengov.github.io/eurostat
Other
234 stars 46 forks source link

Add support for downloading Comext and Prodcom datasets #287

Open pitkant opened 8 months ago

pitkant commented 8 months ago

Downloading data from PRODCOM and COMEXT should be quite similar to downloading datasets from Eurostat database and implementing basic functionalities to download and handle these datasets should be straightforward. The datasets might be quite large however, making it perhaps useful to implement filtering on SDMX queries as well instead of downloading the whole dataset to your computer and filtering it there.

API base URL

API SDMX 2.1 - data filtering

Other datasets to consider:

pitkant commented 7 months ago

In v4.1 branch a query like this works now (2024-01-19):

prodcom <- get_eurostat_sdmx(id = "DS-056120", agency = "eurostat_comext", 
                             filters = 
                               list(
                                 DECL = c("001", "003", "004", "005", "006", "007", "008", "009", "010", "011", "017", "018", "024", "028", "030", "032", "038", "046", "052", "053", "054", "055", "060", "061", "063", "064", "066", "068", "091", "092", "093", "096", "097", "098", "2027", "600"),
                                 FREQ = c("A"),
                                 INDICATORS = c("PRODVAL"),
                                 PRCCODE = c("18121920", "18201010", "18201030", "18201050", "18201070", "18202050", "18202070", "32201110", "32201130", "32201150", "32201200", "32201310", "32201340", "32201370", "32201400", "32201510", "32201530", "32201600", "32202000")))

prodcom_labeled <- label_eurostat_sdmx(x, agency = "eurostat_comext", id = "DS-056120")

For some reason for indicators column the codelist from API does not contain labels but just the names of the codes - PRODVAL in this case. All other columns were labeled as they should so this is probably a problem at Eurostat's side and I will report it to them.