Convert list provided by the APIs into a tibble

convert_list_to_tibble(l)

Arguments

l

a list provided by the API (See doApiQuery)

Value

A tibble::tibble with one row by record and one column by field.

Details

This function is used internally by all the retrieving data functions for converting data after the call to doApiQuery.

Examples

# To get the available APIs in the package
list_apis()
#>  [1] "prelevements"         "indicateurs_services" "hydrometrie"         
#>  [4] "niveaux_nappes"       "poisson"              "ecoulement"          
#>  [7] "hydrobio"             "temperature"          "qualite_eau_potable" 
#> [10] "qualite_nappes"       "qualite_rivieres"    

# To get the available endpoints in an API
list_endpoints("prelevements")
#> [1] "chroniques"         "ouvrages"           "points_prelevement"

# To get available parameters in endpoint "chroniques" of the API "prelevements"
list_params(api = "prelevements", endpoint = "chroniques")
#>  [1] "annee"                      "bbox"                      
#>  [3] "code_commune_insee"         "code_departement"          
#>  [5] "code_mode_obtention_volume" "code_ouvrage"              
#>  [7] "code_qualification_volume"  "code_statut_instruction"   
#>  [9] "code_statut_volume"         "code_usage"                
#> [11] "distance"                   "fields"                    
#> [13] "format"                     "latitude"                  
#> [15] "libelle_departement"        "longitude"                 
#> [17] "nom_commune"                "page"                      
#> [19] "prelevement_ecrasant"       "producteur_donnee"         
#> [21] "size"                       "sort"                      
#> [23] "volume_max"                 "volume_min"                

# To query the endpoint "chroniques" of the API "prelevements"
# on all devices in the commune of Romilly-sur-Seine in 2018
# \dontrun{
resp <- doApiQuery(api = "prelevements",
                   endpoint = "chroniques",
                   code_commune_insee = "10323",
                   annee = "2018")
convert_list_to_tibble(resp)
#> # A tibble: 6 × 28
#>   code_ouvrage  annee volume code_usage libelle_usage         code_statut_volume
#>   <chr>         <int>  <dbl> <chr>      <chr>                 <chr>             
#> 1 OPR0000032603  2018 402383 AEP        EAU POTABLE           1                 
#> 2 OPR0000032604  2018 402383 AEP        EAU POTABLE           1                 
#> 3 OPR0000040119  2018  25174 IND        INDUSTRIE et ACTIVIT… 1                 
#> 4 OPR0000040120  2018  27242 IND        INDUSTRIE et ACTIVIT… 1                 
#> 5 OPR0000199638  2018  30588 IRR        IRRIGATION            1                 
#> 6 OPR0000333915  2018 305611 IND        INDUSTRIE et ACTIVIT… 1                 
#> # ℹ 22 more variables: libelle_statut_volume <chr>,
#> #   code_qualification_volume <chr>, libelle_qualification_volume <chr>,
#> #   code_statut_instruction <chr>, libelle_statut_instruction <chr>,
#> #   code_mode_obtention_volume <chr>, libelle_mode_obtention_volume <chr>,
#> #   prelevement_ecrasant <lgl>, producteur_donnee <chr>, longitude <dbl>,
#> #   latitude <dbl>, code_commune_insee <chr>, nom_commune <chr>,
#> #   code_departement <chr>, libelle_departement <chr>, nom_ouvrage <chr>, …
# }