diff --git a/DESCRIPTION b/DESCRIPTION index ace4835962738c80cfca65345725d845ef2844f8..a89ab33c9d7c7e2a21a96937532afcaa2f2b4e0f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: datalibaba Title: Interface De Connexion a Une Base Posgres Postgis -Version: 0.0.0.9002 +Version: 0.0.0.9003 Authors@R: c(person(given = "Maël", family = "Theulière", @@ -32,7 +32,8 @@ Imports: magrittr, tibble, units, - tidyr + tidyr, + gtools Encoding: UTF-8 LazyData: true Roxygen: list(markdown = TRUE) diff --git a/NAMESPACE b/NAMESPACE index 432161deb8167a9c9164fa18f6488582ed99388e..2c5fe8a8d003cc1877a016b4b52b85fcfc659f93 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -52,6 +52,7 @@ importFrom(dplyr,filter) importFrom(dplyr,mutate) importFrom(dplyr,pull) importFrom(dplyr,relocate) +importFrom(dplyr,rename_with) importFrom(dplyr,select) importFrom(dplyr,summarise) importFrom(dplyr,transmute) @@ -60,6 +61,7 @@ importFrom(fs,path) importFrom(fs,path_expand) importFrom(fs,path_home_r) importFrom(glue,glue) +importFrom(gtools,ASCIIfy) importFrom(magrittr,"%>%") importFrom(odbc,odbc) importFrom(purrr,map) diff --git a/NEWS.md b/NEWS.md index 7b75826ab798f1b76fe2e386ac40adc939693943..c01b4a03672f5078378c72b25a0173e18a5d670a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,6 @@ +# datalibaba 0.0.0.9003 +- Correction d'un bug dans `poster_data()`, la fonction plantait si les modalités d'un facteur contenaient des caractères spéciaux. + # datalibaba 0.0.0.9002 - Correction d'un bug dans la fonction `importer_data()` : nommage du champ geo tel qu'il avait été chargé diff --git a/R/get_data.R b/R/get_data.R index 04b4be6d6f3bb16f1fc04cc3895a3f640039352f..a9279ff4ea4768ab93d58d47d3bcd51a76b804e1 100644 --- a/R/get_data.R +++ b/R/get_data.R @@ -59,7 +59,7 @@ get_data_dbi <- function(con = NULL, #' @return la table de donnees, au format dataframe ou sf dataframe si une colonne de type 'USER-DEFINED' est presente dans la table sgbd #' @importFrom attempt stop_if stop_if_not #' @importFrom DBI dbExistsTable dbReadTable dbDisconnect -#' @importFrom dplyr filter arrange select all_of relocate +#' @importFrom dplyr filter arrange select all_of relocate rename_with #' @importFrom rlang .data #' @importFrom rpostgis dbTableInfo #' @importFrom sf st_read st_drop_geometry st_geometry diff --git a/R/post_data.R b/R/post_data.R index 82e940071b31f1595cdcde8836807defce386909..3758fc07da787df4d54927720ab76cc14b930336 100644 --- a/R/post_data.R +++ b/R/post_data.R @@ -42,6 +42,7 @@ post_data <- function(con, #' @param overwrite TRUE si on veut ecraser le fichier deja present. #' @importFrom attempt stop_if stop_if_not #' @importFrom DBI dbWriteTable Id dbSendQuery +#' @importFrom gtools ASCIIfy #' @importFrom glue glue #' #' @return NULL, la fonction lance le chargement du dataset present dans l'environnement R et son ecriture sur le serveur @@ -199,7 +200,7 @@ poster_data <- function(data = NULL, paste(as.character(attr2), collapse = ","), "},{", paste(noms_r, collapse = ","), "}}") - defs2 <- data.frame(table_nm = table, df_def = defs) + defs2 <- data.frame(table_nm = table, df_def = gtools::ASCIIfy(defs)) suppressWarnings(suppressMessages({ rpostgis::pgInsert(con, c(schema, "zz_r_df_def"), defs2, upsert.using = "table_nm", row.names = FALSE) diff --git a/dev_history.R b/dev_history.R index 19d5f1fb34568f815e07b257e4590d853962be30..214801c5378eeedabaf2b034876411d486e81ee8 100644 --- a/dev_history.R +++ b/dev_history.R @@ -25,6 +25,7 @@ usethis::use_package("rlang") usethis::use_package("units") usethis::use_package("tibble") usethis::use_package("tidyr") +usethis::use_package("gtools") attachment::att_amend_desc() devtools::document() pkgdown::build_site()