-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
We should update the documentation of the behavior of the function statgl_fetch().
When using statgl_fetch the retrived data is as standard shown with the text and not the code string. Can be changed with .col_code = TRUE
However, this is not easily read from the documentation and can lead to unhelpfull warnings and errors if the text string is used as the code variable.
Example:
> statgl_fetch(statgl_url("ARXLED1"))
print(df)
time month value
<chr> <chr> <int>
1 1989 January NA
2 1989 February NA
..., ..., ..., ...
> statgl_fetch(statgl_url("ARXLED1"), month = px_all(), time= c("2022"))
lexical error: invalid char in json text.
Bad Request
(right here) ------^
> statgl_meta("ARXLED1")
$title
[1] "Registered jobseekers by time, district, place of residence and month"
$url
[1] "https://bank.stat.gl:443/api/v1/en/Greenland/AR/AR20/ARXLED1.px"
$variables
# A tibble: 4 x 6
code text elimination time values valueTexts
<chr> <chr> <lgl> <lgl> <list> <list>
1 aar time NA TRUE <chr [36]> <chr [36]>
2 dist_k district TRUE NA <chr [18]> <chr [18]>
3 md month NA NA <chr [13]> <chr [13]>
4 type_k place of residence TRUE NA <chr [3]> <chr [3]>
it is now easy to see, that the that the code to retrive the columns are different than the text displayed.
> statgl_fetch(statgl_url("ARXLED1"), md = px_all(), aar = 2022)
# A tibble: 13 x 3
time month value
<chr> <chr> <int>
1 2022 January 1907
2 2022 February 1830
3 2022 March 1857
4 2022 April 1551
5 2022 May 1458
6 2022 June 1210
7 2022 July 1143
8 2022 August 1121
9 2022 September 987
10 2022 October 1063
11 2022 November 1223
12 2022 December 1432
13 2022 Average per year 1399
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels