ropensci / nomisr

Access UK official statistics from the Nomis database through R.
https://docs.ropensci.org/nomisr
Other
44 stars 12 forks source link

Does 'select' work properly? #12

Closed JimShady closed 5 years ago

JimShady commented 5 years ago

Hi again,

This returns some data

 test <- nomis_get_data(id = "NM_1208_1",
                                   time = "latest",
                                   USUAL_RESIDENCE = "TYPE499",
                                   PLACE_OF_WORK = "TYPE499",
                                  TRANSPORT_POWPEW11 = "2")

names(test)

 [1] "DATE"                         "DATE_NAME"                    "DATE_CODE"                   
 [4] "DATE_TYPE"                    "DATE_TYPECODE"                "DATE_SORTORDER"              
 [7] "USUAL_RESIDENCE"              "USUAL_RESIDENCE_NAME"         "USUAL_RESIDENCE_CODE"        
[10] "USUAL_RESIDENCE_TYPE"         "USUAL_RESIDENCE_TYPECODE"     "USUAL_RESIDENCE_SORTORDER"   
[13] "PLACE_OF_WORK"                "PLACE_OF_WORK_NAME"           "PLACE_OF_WORK_CODE"          
[16] "PLACE_OF_WORK_TYPE"           "PLACE_OF_WORK_TYPECODE"       "PLACE_OF_WORK_SORTORDER"     
[19] "TRANSPORT_POWPEW11"           "TRANSPORT_POWPEW11_NAME"      "TRANSPORT_POWPEW11_CODE"     
[22] "TRANSPORT_POWPEW11_TYPE"      "TRANSPORT_POWPEW11_TYPECODE"  "TRANSPORT_POWPEW11_SORTORDER"
[25] "MEASURES"                     "MEASURES_NAME"                "OBS_VALUE"                   
[28] "OBS_STATUS"                   "OBS_STATUS_NAME"              "OBS_CONF"                    
[31] "OBS_CONF_NAME"                "URN"                          "RECORD_OFFSET"               
[34] "RECORD_COUNT"

So I expected to be able to do this:

 test <- nomis_get_data(id = "NM_1208_1",
                                   time = "latest",
                                   USUAL_RESIDENCE = "TYPE499",
                                   PLACE_OF_WORK = "TYPE499",
                                  TRANSPORT_POWPEW11 = "2",
                                  select = c("USUAL_RESIDENCE_NAME", "PLACE_OF_WORK_NAME"))

But it returns no results. Your example 'select' works in the reference documentation, but not mine, and I can't see any fundamental difference between the two. Grateful for thoughts ...

Thanks, Jim

evanodell commented 5 years ago

So there was a bug caused by my assumption that select would always include "obs_value". That's been fixed in the most recent commit, and should be on CRAN soon.

JimShady commented 5 years ago

Thanks. Will install from Github in the meantime.