dataMaid
dataMaid copied to clipboard
Bypass the writeLine encoding issue with windows to allow special character processing
Hi,
Firstly thank you for that awesome handy package ! I have used it with English labeled data until recently trying it on with French. From what I understood the dataMaid_repord.Rmd is genererated using writeLines which does not play well with special characters (they will appear as ?
in the report and pandoc with complain about incorrect utf8 characters).
Here is a reprex, I am using French local with utf-8 encoding as default :
dfr <- tibble::tibble(
var1 = gl(n = 3, k = 4, labels = c("â", "a", "é", "ì"))
)
dataMaid::makeDataReport(data = dfr,
output = "html",
render = TRUE,
file = "issue_ex.Rmd"
)
#' Data report generation is finished. Please wait while your output file is being rendered.
#' Warning messages:
#' 1: In readLines(con, warn = FALSE) :
#' entrée incorrecte trouvée dans la connexion en entrée 'issue_ex.Rmd'
#' 2: In knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet) :
#' The file "issue_ex.Rmd" must be encoded in UTF-8. Please see https://yihui.org/en/2018/11/biggest-regret-knitr/ for more info.
#' 3: In readLines(con, warn = FALSE) :
entrée incorrecte trouvée dans la connexion en entrée 'issue_ex.knit.md'
#' 4: In readLines(con, warn = FALSE) :
entrée incorrecte trouvée dans la connexion en entrée 'issue_ex.utf8.md'
getOption("encoding")
#' [1] "native.enc"
sessionInfo()
#' R version 4.0.4 (2021-02-15)
#' Platform: x86_64-w64-mingw32/x64 (64-bit)
#' Running under: Windows 10 x64 (build 19042)
#' Matrix products: default
#' locale:
#' [1] LC_COLLATE=French_France.1252 LC_CTYPE=French_France.1252
#' [3] LC_MONETARY=French_France.1252 LC_NUMERIC=C
#' [5] LC_TIME=French_France.1252
#' attached base packages:
#' [1] stats graphics grDevices utils datasets methods base
#' other attached packages:
#' [1] pander_0.6.3 ggplot2_3.3.2
#' loaded via a namespace (and not attached):
#' [1] Rcpp_1.0.6 pillar_1.4.6 compiler_4.0.4 DEoptimR_1.0-8
#' [5] forcats_0.5.1 tools_4.0.4 digest_0.6.27 dataMaid_1.4.0
#' [9] evaluate_0.14 jsonlite_1.7.2 lifecycle_1.0.0 tibble_3.0.3
#' [13] gtable_0.3.0 pkgconfig_2.0.3 rlang_0.4.10 whoami_1.3.0
#' [17] cli_2.0.2 yaml_2.2.1 xfun_0.15 haven_2.3.1
#' [21] gridExtra_2.3 withr_2.4.1 stringr_1.4.0 knitr_1.29
#' [25] dplyr_1.0.0 httr_1.4.1 generics_0.0.2 vctrs_0.3.6
#' [29] hms_0.5.3 grid_4.0.4 tidyselect_1.1.0 glue_1.4.2
#' [33] robustbase_0.93-6 R6_2.5.0 fansi_0.4.1 rmarkdown_2.6
#' [37] farver_2.0.3 purrr_0.3.4 magrittr_2.0.1 scales_1.1.1
#' [41] ellipsis_0.3.1 htmltools_0.5.1.1 assertthat_0.2.1 colorspace_1.4-1
#' [45] labeling_0.3 stringi_1.5.3 munsell_0.5.0 crayon_1.4.1
Thanks for reporting the bug!
I'm not able to reproduce your error in the development version of the package, so I think this issue may have been resolved by other changes we made to the package since the last CRAN version. So would you mind trying to install the development version and see if the problem still occurs? If the problem is still there, we'll look closer into it of course.
You can install the development version like this:
devtools::install_github("ekstroem/dataReporter")
Note that we have renamed the package to dataReporter
and that all updates/future development will be carried out with that package instead.