Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow users to switch between labels and codes #5

Closed
GregorDeCillia opened this issue Sep 17, 2020 · 0 comments
Closed

Allow users to switch between labels and codes #5

GregorDeCillia opened this issue Sep 17, 2020 · 0 comments
Assignees
Milestone

Comments

@GregorDeCillia
Copy link
Contributor

The statcube api contains codes and labels for all variables. Currently, as.data.frame() always uses codes for column names and field entries. Make this behavior optional so users can also work with codes.

The conversion between codes and labels is pretty straightforward when sc_meta() or sc_meta_field() is used because those functions can be used as "translators".

json_path <- sc_example("bev_seit_1982.json")
my_response <- sc_get_response(json_path)

sc_meta(my_response)
## $database
##                                 label         code
## 1 Bevölkerung zu Jahresbeginn ab 1982 debevstandjb
## 
## $measures
##      label     code fun precision
## 1 Fallzahl F-ISIS-1 SUM         0
## 
## $fields
##         label        code nitems
## 1        Jahr     C-A10-0     40
## 2  Bundesland    C-BB00-0     11
## 3 Geburtsland C-GEBLAND-0      3

sc_meta_field(my_response, 2)
##                        label code       type
## 1          Burgenland <AT11>    1 RecodeItem
## 2             Kärnten <AT21>    2 RecodeItem
## 3    Niederösterreich <AT12>    3 RecodeItem
## 4      Oberösterreich <AT31>    4 RecodeItem
## 5            Salzburg <AT32>    5 RecodeItem
## 6          Steiermark <AT22>    6 RecodeItem
## 7               Tirol <AT33>    7 RecodeItem
## 8          Vorarlberg <AT34>    8 RecodeItem
## 9                Wien <AT13>    9 RecodeItem
## 10 Nicht klassifizierbar <0>    0 RecodeItem
## 11                  Zusammen           Total
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant