Error in dst_get_data()
fghjorth opened this issue · comments
This is a terrifically useful package! Unfortunately, I get an error message "object of type 'closure' is not subsettable" when running dst_get_data(), even when running exactly the examples in the Readme file. It shows up both in Windows and OSX. Am I missing something obvious?
> library(dkstat)
>
> #test github readme examples
> aulaar <- dst_get_data(table = "AULAAR", KØN = "Total", PERPCT = "Per cent of the labour force", Tid = 2013,lang = "en")
Error in dst_meta$values : object of type 'closure' is not subsettable
>
> folk1_meta <- dst_meta("folk1", lang = "da")
> my_query <- list(OMRÅDE = c("Hele landet", "København", "Frederiksberg", "Odense"),
+ STATSB = "Danmark",
+ TID = "*")
> dst_get_data(table = "folk1", query = my_query, lang = "da")
Error in dst_meta$values : object of type 'closure' is not subsettable
I'll check it out some time this weekend. Can I get your sessionInfo()?
Thanks a lot! sessionInfo() here:
> sessionInfo()
R version 3.2.0 (2015-04-16)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.5 (Yosemite)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] httr_1.0.0 dkstat_0.05 devtools_1.8.0
loaded via a namespace (and not attached):
[1] XML_3.98-1.2 digest_0.6.8 bitops_1.0-6 R6_2.1.1 jsonlite_0.9.17
[6] git2r_0.10.1 magrittr_1.5 stringi_0.5-5 curl_0.9.3 rstudioapi_0.3.1
[11] tools_3.2.0 stringr_1.0.0 RCurl_1.95-4.6 rversions_1.0.0 memoise_0.2.1
FWIW, it may be that the code tries to index a function somewhere, cf. http://stackoverflow.com/a/11308796
I've tried to work through dst_get_data() step by step. It looks like the bug is in the dst_query_match() helper function.
I just pushed a new version. I couldn't reproduce your error because I had already fixed the function dst_query_match locally but had forgotten to commit and push the changes.
I tried to subset on dst_meta (the function) instead of the meta_data. Sorry about the problems you were having. I hope it works now.
Yes, it works now! Thanks for looking into this so quickly. And I'm just happy to contribute in my small way 😄