Skip to content

Commit

Permalink
fix(qualite_rivieres): encoding issue on field libelle_station
Browse files Browse the repository at this point in the history
  • Loading branch information
DDorch committed Feb 21, 2024
1 parent 91a2e0b commit 2934497
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
15 changes: 11 additions & 4 deletions R/get_qualite_rivieres.R
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ get_qualite_rivieres_analyse <- function(...) {
l <- doApiQuery(api = "qualite_rivieres",
endpoint = "analyse_pc",
...)
convert_list_to_tibble(l)
convert_list_to_tibble(l) %>% fix_encoding_libelle_station
}

#' @export
Expand All @@ -125,7 +125,7 @@ get_qualite_rivieres_condition_environnementale <- function(...) {
l <- doApiQuery(api = "qualite_rivieres",
endpoint = "condition_environnementale_pc",
...)
convert_list_to_tibble(l)
convert_list_to_tibble(l) %>% fix_encoding_libelle_station
}

#' @export
Expand All @@ -134,7 +134,7 @@ get_qualite_rivieres_operation <- function(...) {
l <- doApiQuery(api = "qualite_rivieres",
endpoint = "operation_pc",
...)
convert_list_to_tibble(l)
convert_list_to_tibble(l) %>% fix_encoding_libelle_station
}

#' @export
Expand All @@ -143,5 +143,12 @@ get_qualite_rivieres_station <- function(...) {
l <- doApiQuery(api = "qualite_rivieres",
endpoint = "station_pc",
...)
convert_list_to_tibble(l)
convert_list_to_tibble(l) %>% fix_encoding_libelle_station
}

fix_encoding_libelle_station <- function(df) {
if ("libelle_station" %in% names(df)) {
return(df %>% mutate(libelle_station = iconv(libelle_station, to = "iso8859-1", from = "utf8")))
}
return(df)
}
1 change: 1 addition & 0 deletions R/globals.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ utils::globalVariables(
'code_commune',
'libelle_departement',
'libelle_region',
'libelle_station',
'longitude'
)
)
Binary file modified inst/vignettes/data_extraction_naiades.RData
Binary file not shown.

0 comments on commit 2934497

Please sign in to comment.