rOpenGov / dkstat

API connection to the StatBank from Statistics Denmark

Home Page:http://ropengov.github.io/dkstat/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem grabbing multiple values

ekstroem opened this issue · comments

Howdy,

I'm just messing about on dst and tried to grab various datasets. Here's one where I end up with an error when I try to grab all the data.

library(dkstat)
indata <- dst_get_data(table="BEV3A", "BEVÆGELSEV"="Levendefødte", TID="1901M01")

This goes well. However, if I try to get all the data then I end up with an error.

indata <- dst_get_data(table="BEV3A", "BEVÆGELSEV"="Levendefødte", TID="*")

The code above yields the error

Error in names(dst_data) <- c(dst_names, "value") :
'names' attribute [3] must be the same length as the vector [1]

Could you tell me why?

Small update. If I grab data from 15 years (all 12 months) then all is fine but 16 years produces the error.

Hi

It seems the limit on the number of values has been lowered from 100.000 to 1.000.

I'll have a fix ready as soon.

Notes to self:

  • Make sure to check the status code before parsing the content. If the status is not 200, then return the "message".
  • Try out the streaming service as this doesn't have the same limits.

You will now get an error message if the request is for more than 1000 values. I'll follow up on the streaming service soon.

Thanks for investigating this. I'll think of a way to automatically split up a large request to several smaller :)

I thought about doing the same thing in the package.

I have added the possibility to request the data in the BULK format. You need to specify values for all the columns though :)