Pool and RMySQL suddenly using the wrong encoding - r

I've been regularly loading data from my company database. Yesterday I installed R 4.1.3. Since then, the encoding of the data I load using pool is messed up. Not sure what encoding is used, but I'd need UTF-8.
I checked on my colleague's computer, who is still running R 4.1.2, and with the exact same code he doesn't have that issue. Any idea why? And possibly if I can set a global parameter for that?
My session info:
> sessionInfo()
R version 4.1.3 (2022-03-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22000)
Matrix products: default
locale:
[1] LC_COLLATE=English_Switzerland.1252 LC_CTYPE=English_Switzerland.1252 LC_MONETARY=English_Switzerland.1252 LC_NUMERIC=C
[5] LC_TIME=English_Switzerland.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] showtext_0.9-5 showtextdb_3.0 sysfonts_0.8.8 ggnewscale_0.4.6 scales_1.1.1 hrbrthemes_0.8.0 ggthemes_4.2.4 pool_0.1.6
[9] highcharter_0.9.4 reshape2_1.4.4 lubridate_1.8.0 zoo_1.8-9 viridis_0.6.2 viridisLite_0.4.0 forcats_0.5.1 stringr_1.4.0
[17] dplyr_1.0.8 purrr_0.3.4 readr_2.1.2 tidyr_1.2.0 tibble_3.1.6 ggplot2_3.3.5 tidyverse_1.3.1
loaded via a namespace (and not attached):
[1] httr_1.4.2 RMySQL_0.10.23 jsonlite_1.8.0 modelr_0.1.8 assertthat_0.2.1 TTR_0.24.3 cellranger_1.1.0 yaml_2.3.5
[9] gdtools_0.2.4 Rttf2pt1_1.3.10 pillar_1.7.0 backports_1.4.1 lattice_0.20-45 glue_1.6.2 rlist_0.4.6.2 extrafontdb_1.0
[17] digest_0.6.29 rvest_1.0.2 colorspace_2.0-3 htmltools_0.5.2 plyr_1.8.6 pkgconfig_2.0.3 broom_0.7.12 haven_2.4.3
[25] later_1.3.0 tzdb_0.2.0 generics_0.1.2 ellipsis_0.3.2 withr_2.5.0 cli_3.2.0 quantmod_0.4.18 magrittr_2.0.2
[33] crayon_1.5.0 readxl_1.3.1 evaluate_0.15 fs_1.5.2 fansi_1.0.2 xts_0.12.1 xml2_1.3.3 data.table_1.14.2
[41] tools_4.1.3 hms_1.1.1 lifecycle_1.0.1 munsell_0.5.0 reprex_2.0.1 compiler_4.1.3 systemfonts_1.0.4 rlang_1.0.2
[49] grid_4.1.3 rstudioapi_0.13 htmlwidgets_1.5.4 igraph_1.2.11 rmarkdown_2.13 gtable_0.3.0 DBI_1.1.2 curl_4.3.2
[57] R6_2.5.1 gridExtra_2.3 knitr_1.37 fastmap_1.1.0 extrafont_0.17 utf8_1.2.2 stringi_1.7.6 Rcpp_1.0.8.3

Related

Update atributte table columns contents (character type) from other joined csv table (r software)

I've tried merge and update columns values with this code.
For now the joined fields are correct. (#1)
Now I want update the fields of column.x with values in column.y.
I'm using the second part (#2) but without success.
#1 - code to merge table 'parcelas_sql' with 'tbd_con_sig' by 'codigo'
join_sig_csv <- merge(parcelas_sql, tbd_cons_sig, by.x = "codigo", by.y = "codigo", duplicateGeoms=TRUE)
#2 - update field 'n.cont.x' with 'n.cont.y' values
join_sig_csv[join_sig_csv$n.cont.x == n.cont.x] <- n.cont.y
error_message:
Error in h(simpleError(msg, call)) :
error in evaluating the argument 'i' in selecting a method for function '[<-': object 'n.cont.x' not found
-------------------------------------- sessionInfo() -----------------
version 4.1.2 (2021-11-01)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
Matrix products: default
locale:
[1] LC_COLLATE=Portuguese_Portugal.1252 LC_CTYPE=Portuguese_Portugal.1252 LC_MONETARY=Portuguese_Portugal.1252 LC_NUMERIC=C
[5] LC_TIME=Portuguese_Portugal.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] RODBC_1.3-19 maptools_1.1-4 sf_1.0-7 terra_1.5-21 spData_2.0.1 rgdal_1.5-32 rgeos_0.5-9 sp_1.4-6 rvest_1.0.2 showtext_0.9-5
[11] showtextdb_3.0 sysfonts_0.8.8 classInt_0.4-3 tmap_3.3-3 lubridate_1.8.0 fs_1.5.2 forcats_0.5.1 stringr_1.4.0 dplyr_1.0.7 purrr_0.3.4
[21] readr_2.1.1 tidyr_1.1.4 tibble_3.1.6 ggplot2_3.3.5 tidyverse_1.3.1
loaded via a namespace (and not attached):
[1] RColorBrewer_1.1-2 httr_1.4.2 tools_4.1.2 backports_1.4.1 utf8_1.2.2 R6_2.5.1
[7] KernSmooth_2.23-20 DBI_1.1.2 colorspace_2.0-2 raster_3.5-15 withr_2.4.3 tidyselect_1.1.1
[13] leaflet_2.1.1 compiler_4.1.2 leafem_0.2.0 cli_3.1.0 xml2_1.3.3 scales_1.1.1
[19] proxy_0.4-26 digest_0.6.29 foreign_0.8-81 base64enc_0.1-3 dichromat_2.0-0.1 pkgconfig_2.0.3
[25] htmltools_0.5.2 dbplyr_2.1.1 fastmap_1.1.0 htmlwidgets_1.5.4 rlang_0.4.12 readxl_1.3.1
[31] rstudioapi_0.13 generics_0.1.1 jsonlite_1.7.2 crosstalk_1.2.0 magrittr_2.0.1 Rcpp_1.0.7
[37] munsell_0.5.0 fansi_0.5.0 abind_1.4-5 lifecycle_1.0.1 stringi_1.7.6 leafsync_0.1.0
[43] tmaptools_3.1-1 grid_4.1.2 parallel_4.1.2 crayon_1.4.2 lattice_0.20-45 stars_0.5-5
[49] haven_2.4.3 hms_1.1.1 pillar_1.6.4 codetools_0.2-18 reprex_2.0.1 XML_3.99-0.8
[55] glue_1.6.0 leaflet.providers_1.9.0 modelr_0.1.8 png_0.1-7 vctrs_0.3.8 tzdb_0.2.0
[61] cellranger_1.1.0 gtable_0.3.0 assertthat_0.2.1 lwgeom_0.2-8 broom_0.7.11 e1071_1.7-9
[67] class_7.3-19 viridisLite_0.4.0 units_0.8-0 ellipsis_0.3.2

ShinyApp accents and special characters problems

I would like to know how I can solve the problem of accents and special characters, I don't know why special characters (´,ñ, etc) appear wrong, with the code I don't have any problem but when running the shiny app all the labels where this type of characters are appear as an attachment in the image below. I have read about saving with utf-8 encoding but the problem is still not fixed, below I share information about my session.
wrong labels: Número, Gráfico, Comunicación
R version 3.6.3 (2020-02-29)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)
Matrix products: default
locale:
[1] LC_COLLATE=Spanish_Spain.1252 LC_CTYPE=Spanish_Spain.1252
[3] LC_MONETARY=Spanish_Spain.1252 LC_NUMERIC=C
[5] LC_TIME=Spanish_Spain.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods
[7] base
other attached packages:
[1] stringi_1.6.1 plotly_4.10.0 ggplot2_3.3.5
[4] dplyr_1.0.7 shinyFiles_0.9.1 visNetwork_2.1.0
[7] openxlsx_4.2.4 shinyalert_2.0.0 lubridate_1.7.10
[10] data.table_1.14.2 DT_0.20 shinyjs_2.0.0
[13] shiny_1.7.1
loaded via a namespace (and not attached):
[1] Rcpp_1.0.6 lattice_0.20-38 tidyr_1.1.4
[4] assertthat_0.2.1 digest_0.6.27 utf8_1.2.1
[7] mime_0.10 R6_2.5.1 evaluate_0.14
[10] httr_1.4.2 pillar_1.6.4 rlang_0.4.11
[13] uuid_0.1-4 lazyeval_0.2.2 fontawesome_0.2.2
[16] rstudioapi_0.13 jquerylib_0.1.4 rmarkdown_2.11
[19] foreign_0.8-75 htmlwidgets_1.5.4 munsell_0.5.0
[22] compiler_3.6.3 httpuv_1.6.1 xfun_0.30
[25] pkgconfig_2.0.3 htmltools_0.5.2 tidyselect_1.1.1
[28] tibble_3.1.1 fansi_0.4.2 viridisLite_0.4.0
[31] crayon_1.4.2 withr_2.4.2 later_1.2.0
[34] grid_3.6.3 jsonlite_1.7.2 xtable_1.8-4
[37] gtable_0.3.0 lifecycle_1.0.1 DBI_1.1.2
[40] magrittr_2.0.1 scales_1.1.1 zip_2.2.0
[43] cli_3.1.0 cachem_1.0.4 fs_1.5.0
[46] promises_1.2.0.1 sp_1.4-6 bslib_0.3.1
[49] ellipsis_0.3.2 generics_0.1.1 vctrs_0.3.8
[52] tools_3.6.3 glue_1.4.2 purrr_0.3.4
[55] crosstalk_1.1.1 rsconnect_0.8.25 fastmap_1.1.0
[58] yaml_2.2.1 colorspace_2.0-1 maptools_1.1-2
[61] knitr_1.36 sass_0.4.0

MICE package in R 10x slower with new R

I recently updated my R (from 4.0 to 4.2) and now mice() runs much slower on the same data. Has this happened to anyone else ?
Maybe my .Renviron got reset and something like the R_MAX_VSIZE needs to change ? It doesn't seem to help mice().
Thank you !
> sessionInfo()
R version 4.2.0 (2022-04-22)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Monterey 12.3.1
Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] mice_3.14.0 bigrquery_1.4.0 forcats_0.5.1 stringr_1.4.0 dplyr_1.0.9
[6] purrr_0.3.4 readr_2.1.2 tidyr_1.2.0 tibble_3.1.7 ggplot2_3.3.6
[11] tidyverse_1.3.1 sqldf_0.4-11 RSQLite_2.2.14 gsubfn_0.7 proto_1.0.0
[16] mgcv_1.8-40 nlme_3.1-157 civis_3.0.0
loaded via a namespace (and not attached):
[1] httr_1.4.3 bit64_4.0.5 jsonlite_1.8.0 splines_4.2.0 modelr_0.1.8
[6] assertthat_0.2.1 blob_1.2.3 cellranger_1.1.0 progress_1.2.2 globals_0.15.0
[11] pillar_1.7.0 backports_1.4.1 lattice_0.20-45 glue_1.6.2 chron_2.3-56
[16] digest_0.6.29 rvest_1.0.2 colorspace_2.0-3 Matrix_1.4-1 pkgconfig_2.0.3
[21] broom_0.8.0 listenv_0.8.0 haven_2.5.0 scales_1.2.0 tzdb_0.3.0
[26] generics_0.1.2 ellipsis_0.3.2 cachem_1.0.6 withr_2.5.0 cli_3.3.0
[31] magrittr_2.0.3 crayon_1.5.1 readxl_1.4.0 memoise_2.0.1 fs_1.5.2
[36] future_1.25.0 fansi_1.0.3 parallelly_1.31.1 xml2_1.3.3 prettyunits_1.1.1
[41] tools_4.2.0 hms_1.1.1 gargle_1.2.0 lifecycle_1.0.1 munsell_0.5.0
[46] reprex_2.0.1 compiler_4.2.0 rlang_1.0.2 grid_4.2.0 rstudioapi_0.13
[51] arrow_8.0.0 gtable_0.3.0 codetools_0.2-18 DBI_1.1.2 curl_4.3.2
[56] brutils_0.1.0 R6_2.5.1 lubridate_1.8.0 fastmap_1.1.0 bit_4.0.4
[61] utf8_1.2.2 stringi_1.7.6 parallel_4.2.0 Rcpp_1.0.8.3 vctrs_0.4.1
[66] dbplyr_2.1.1 tidyselect_1.1.2
Sadly I don't have sessionInfo() for my previous version of R.

XDG_RUNTIME_DIR when exporting kable to image (Rstudio + Ubuntu 20.04)

I'm trying to export table made with kableExtra in R. It looks ok in the R Studio environment but if I try to export it it gives me this error:
> kable(csv) %>%
+ kable_styling("striped", full_width = F, htmltable_class = 'Liberation Sans') %>%
+ kable_minimal() %>%
+ save_kable(file = paste0(outdir, name, '.png'), bs_theme = "flatly",
+ zoom = 1.5)
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-cesarkero'
error: XDG_RUNTIME_DIR not set in the environment.
TypeError: Attempting to change the setter of an unconfigurable property.
TypeError: Attempting to change the setter of an unconfigurable property.
Error in magick_image_trim(image, fuzz) :
rsession: geometry does not contain image `/home/cesarkero/HDD/D4/GoogleDrive/Proyectos/Master_UNED/01_Materias/06_EE/07_Trabajo/03_Resultados/04_CONSOLIDADOS/07a.png' # warning/attribute.c/GetImageBoundingBox/247
The file is exported but totally empty.
Here is the file used as csv object: https://drive.google.com/file/d/1fmplGNKB7MSKvXpNI_YrThE1F2EKszTf/view?usp=sharing
Update 19/04/2022
If I try this I get a similar error:
> webshot::install_phantomjs()
Error: invalid version specification ‘QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-cesarkero'’
I had already installed phantomjs in linux terminal with:
sudo apt-get install -y phantomjs
Here is my sessionInfo():
> sessionInfo()
R version 4.1.3 (2022-03-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.4 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/liblapack.so.3
locale:
[1] LC_CTYPE=es_ES.UTF-8 LC_NUMERIC=C
[3] LC_TIME=es_ES.UTF-8 LC_COLLATE=es_ES.UTF-8
[5] LC_MONETARY=es_ES.UTF-8 LC_MESSAGES=es_ES.UTF-8
[7] LC_PAPER=es_ES.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=es_ES.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] landtools_0.1.0 lubridate_1.8.0 plyr_1.8.6
[4] data.table_1.14.2 raster_3.5-15 rgeos_0.5-9
[7] rgdal_1.5-28 sp_1.4-6 exifr_0.3.2
[10] nngeo_0.4.5 spatstat_2.3-3 spatstat.linnet_2.3-2
[13] spatstat.core_2.4-0 rpart_4.1.16 nlme_3.1-157
[16] spatstat.random_2.1-0 spatstat.geom_2.3-2 spatstat.data_2.1-2
[19] purrr_0.3.4 readODS_1.7.0 stringr_1.4.0
[22] mapview_2.10.0 dplyr_1.0.8 readr_2.1.2
[25] sf_1.0-7 magrittr_2.0.3 magick_2.7.3
[28] kableExtra_1.3.4
loaded via a namespace (and not attached):
[1] spatstat.sparse_2.1-0 satellite_1.0.4 webshot_0.5.2
[4] httr_1.4.2 tools_4.1.3 utf8_1.2.2
[7] R6_2.5.1 KernSmooth_2.23-20 DBI_1.1.2
[10] mgcv_1.8-40 colorspace_2.0-3 processx_3.5.2
[13] tidyselect_1.1.2 leaflet_2.1.0 compiler_4.1.3
[16] leafem_0.1.6 cli_3.2.0 rvest_1.0.2
[19] xml2_1.3.3 scales_1.1.1 classInt_0.4-3
[22] callr_3.7.0 proxy_0.4-26 rappdirs_0.3.3
[25] goftest_1.2-3 systemfonts_1.0.4 digest_0.6.29
[28] foreign_0.8-82 spatstat.utils_2.3-0 rmarkdown_2.13
[31] svglite_2.1.0 base64enc_0.1-3 pkgconfig_2.0.3
[34] htmltools_0.5.2 fastmap_1.1.0 htmlwidgets_1.5.4
[37] rlang_1.0.2 rstudioapi_0.13 generics_0.1.2
[40] crosstalk_1.2.0 Matrix_1.4-1 Rcpp_1.0.8.2
[43] munsell_0.5.0 fansi_1.0.3 abind_1.4-5
[46] lifecycle_1.0.1 terra_1.5-21 stringi_1.7.6
[49] maptools_1.1-3 grid_4.1.3 crayon_1.5.1
[52] deldir_1.0-6 lattice_0.20-45 splines_4.1.3
[55] tensor_1.5 hms_1.1.1 ps_1.6.0
[58] knitr_1.37 pillar_1.7.0 codetools_0.2-18
[61] stats4_4.1.3 glue_1.6.2 evaluate_0.15
[64] png_0.1-7 vctrs_0.4.0 tzdb_0.2.0
[67] polyclip_1.10-0 assertthat_0.2.1 xfun_0.30
[70] e1071_1.7-9 class_7.3-20 viridisLite_0.4.0
[73] tibble_3.1.6 units_0.8-0 ellipsis_0.3.2
First you need to install the phantomjs from the webshot package using the following code:
webshot::install_phantomjs()
After that, you can run the following code which will output your table as table.png:
library(knitr)
library(kableExtra)
library(magrittr)
kable(csv) %>%
kable_styling("striped", full_width = F, htmltable_class = 'Liberation Sans') %>%
kable_minimal() %>%
save_kable(file = "table.png", bs_theme = "flatly", zoom = 1.5)
The output looks like this:
Please note that your table is really big.
Here is my sessionInfo:
> sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS 12.3.1
Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib
locale:
[1] nl_NL.UTF-8/nl_NL.UTF-8/nl_NL.UTF-8/C/nl_NL.UTF-8/nl_NL.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] readxl_1.3.1 ggforce_0.3.3 dummies_1.5.6 plyr_1.8.6 magrittr_2.0.3 knitr_1.37
[7] kableExtra_1.3.4 terra_1.5-21 reshape_0.8.8 epitools_0.5-10.1 forcats_0.5.1 stringr_1.4.0
[13] readr_2.1.2 tidyverse_1.3.1 DALEXtra_2.1.1 DALEX_2.4.0 mlbench_2.1-3 yardstick_0.0.9
[19] workflowsets_0.1.0 workflows_0.2.4 tune_0.1.6 tidyr_1.2.0 tibble_3.1.6 rsample_0.1.1
[25] recipes_0.2.0 purrr_0.3.4 parsnip_0.2.0 modeldata_0.1.1 infer_1.0.0 ggplot2_3.3.5
[31] dplyr_1.0.8 dials_0.1.0 scales_1.1.1 broom_0.7.12 tidymodels_0.1.4 mapview_2.10.0
loaded via a namespace (and not attached):
[1] utf8_1.2.2 reticulate_1.24 tidyselect_1.1.2 htmlwidgets_1.5.4 grid_4.1.0 pROC_1.18.0
[7] munsell_0.5.0 codetools_0.2-18 units_0.8-0 future_1.24.0 withr_2.5.0 colorspace_2.0-3
[13] highr_0.9 uuid_1.0-4 rstudioapi_0.13 stats4_4.1.0 Rttf2pt1_1.3.8 listenv_0.8.0
[19] labeling_0.4.2 polyclip_1.10-0 plotROC_2.2.1 bit64_4.0.5 DiceDesign_1.9 farver_2.1.0
[25] rprojroot_2.0.2 parallelly_1.30.0 vctrs_0.4.0 generics_0.1.2 ipred_0.9-12 xfun_0.30
[31] R6_2.5.1 doParallel_1.0.17 ggiraph_0.8.2 flexmix_2.3-17 lhs_1.1.4 assertthat_0.2.1
[37] vroom_1.5.7 nnet_7.3-17 gtable_0.3.0 globals_0.14.0 processx_3.5.2 timeDate_3043.102
[43] rlang_1.0.2 systemfonts_1.0.4 modMax_1.1 splines_4.1.0 rgdal_1.5-28 extrafontdb_1.0
[49] lazyeval_0.2.2 ModelMetrics_1.2.2.2 yaml_2.3.5 reshape2_1.4.4 modelr_0.1.8 crosstalk_1.2.0
[55] backports_1.4.1 caret_6.0-90 extrafont_0.17 tools_4.1.0 lava_1.6.10 ellipsis_0.3.2
[61] raster_3.5-15 jquerylib_0.1.4 proxy_0.4-26 Rcpp_1.0.8.3 base64enc_0.1-3 progress_1.2.2
[67] classInt_0.4-3 ps_1.6.0 prettyunits_1.1.1 rpart_4.1.16 haven_2.4.3 fs_1.5.2
[73] here_1.0.1 leafem_0.1.6 furrr_0.2.3 magick_2.7.3 data.table_1.14.2 SparseM_1.81
[79] reprex_2.0.1 GPfit_1.0-8 hms_1.1.1 evaluate_0.15 leaflet_2.0.3.9000 compiler_4.1.0
[85] ingredients_2.2.0 KernSmooth_2.23-20 crayon_1.5.1 htmltools_0.5.2 tzdb_0.2.0 lubridate_1.8.0
[91] DBI_1.1.2 tweenr_1.0.2 dbplyr_2.1.1 MASS_7.3-55 sf_1.0-7 Matrix_1.4-0
[97] cli_3.2.0 parallel_4.1.0 gower_1.0.0 igraph_1.2.11 pkgconfig_2.0.3 sp_1.4-6
[103] plotly_4.10.0 xml2_1.3.3 foreach_1.5.2 svglite_2.1.0 bslib_0.3.1 hardhat_0.2.0
[109] webshot_0.5.2 prodlim_2019.11.13 rvest_1.0.2 callr_3.7.0 digest_0.6.29 rmarkdown_2.13
[115] cellranger_1.1.0 kernlab_0.9-29 gtools_3.9.2 satellite_1.0.4 modeltools_0.2-23 lifecycle_1.0.1
[121] nlme_3.1-155 jsonlite_1.8.0 viridisLite_0.4.0 fansi_1.0.3 pillar_1.7.0 lattice_0.20-45
[127] fastmap_1.1.0 httr_1.4.2 survival_3.3-1 glue_1.6.2 png_0.1-7 iterators_1.0.14
[133] bit_4.0.4 class_7.3-20 stringi_1.7.6 sass_0.4.1 e1071_1.7-9 future.apply_1.8.1

table does not appear when using the package formattable() in R 4.1.0 or R 4.0.3 version

I'm trying to use formatable() but I'm not successful. I'm using some examples from the official CRAN documentation, but not even the examples are running.
i try version R 4.1.0 and 4.0.3, but dont worked.
my code exemple:
library(formattable)
formattable(mtcars, list(mpg = color_bar("lightgray", proportion)))
when using the command the column information disappears
Update:
SessionInfo()
R version 4.0.5 (2021-03-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 8.1 x64 (build 9600)
Matrix products: default
locale:
[1] LC_COLLATE=Portuguese_Brazil.1252 LC_CTYPE=Portuguese_Brazil.1252
[3] LC_MONETARY=Portuguese_Brazil.1252 LC_NUMERIC=C
[5] LC_TIME=Portuguese_Brazil.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] dplyr_1.0.2 readxl_1.3.1 writexl_1.3.1 webshot_0.5.2
[5] htmltools_0.4.0 formattable_0.2.1
loaded via a namespace (and not attached):
[1] Rcpp_1.0.4.6 cellranger_1.1.0 pillar_1.4.6 compiler_4.0.5
[5] dbplyr_1.4.4 tools_4.0.5 digest_0.6.25 jsonlite_1.6.1
[9] evaluate_0.14 lubridate_1.7.9 lifecycle_0.2.0 tibble_3.0.1
[13] gtable_0.3.0 lattice_0.20-41 pkgconfig_2.0.3 rlang_0.4.7
[17] DBI_1.1.0 cli_2.0.2 rstudioapi_0.11 yaml_2.2.1
[21] xfun_0.14 terra_1.2-10 raster_3.4-5 knitr_1.28
[25] generics_0.0.2 vctrs_0.3.4 htmlwidgets_1.5.1 grid_4.0.5
[29] tidyselect_1.1.0 glue_1.4.1 R6_2.4.1 fansi_0.4.1
[33] rmarkdown_2.2 sp_1.4-2 purrr_0.3.4 ggplot2_3.3.2
[37] blob_1.2.1 magrittr_1.5 scales_1.1.1 codetools_0.2-18
[41] ellipsis_0.3.1 assertthat_0.2.1 colorspace_1.4-1 munsell_0.5.0
[45] crayon_1.3.4
formattable_0.2.1
Can you provide sessionInfo(), please? I tried to run the code, and it works fine for me.
This is my sessionInfo():
R version 4.1.0 (2021-05-18)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Pop!_OS 20.04 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_DK.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_DK.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_DK.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_DK.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] formattable_0.2.1 forcats_0.5.1 stringr_1.4.0 dplyr_1.0.6 purrr_0.3.4 readr_1.4.0 tidyr_1.1.3
[8] tibble_3.1.2 ggplot2_3.3.3 tidyverse_1.3.1
loaded via a namespace (and not attached):
[1] tidyselect_1.1.1 xfun_0.23 bslib_0.2.4 haven_2.4.1 colorspace_2.0-1 vctrs_0.3.8 generics_0.1.0
[8] htmltools_0.5.1.1 yaml_2.2.1 utf8_1.2.1 rlang_0.4.11 jquerylib_0.1.4 pillar_1.6.1 glue_1.4.2
[15] withr_2.4.2 DBI_1.1.1 dbplyr_2.1.1 modelr_0.1.8 readxl_1.3.1 lifecycle_1.0.0 munsell_0.5.0
[22] gtable_0.3.0 cellranger_1.1.0 rvest_1.0.0 htmlwidgets_1.5.3 evaluate_0.14 knitr_1.33 fansi_0.4.2
[29] broom_0.7.6 Rcpp_1.0.6 scales_1.1.1 backports_1.2.1 jsonlite_1.7.2 fs_1.5.0 hms_1.1.0
[36] digest_0.6.27 stringi_1.6.2 grid_4.1.0 cli_2.5.0 tools_4.1.0 sass_0.3.1 magrittr_2.0.1
[43] crayon_1.4.1 pkgconfig_2.0.3 ellipsis_0.3.2 xml2_1.3.2 reprex_2.0.0 lubridate_1.7.10 assertthat_0.2.1
[50] rmarkdown_2.8 httr_1.4.2 rstudioapi_0.13 R6_2.5.0 compiler_4.1.0
What version of formattable_0.2.1 and R Studio are you using?
Edit 1: It appears that the font is white. Can you try to edit the color of cyl, and see what happens?
formattable(mtcars, list(mpg = color_bar("lightgray", proportion), cyl = color_text("blue", "blue")))
Edit 2: You are using an outdated R Studio version, however, the problem is related to the themes. If you are using custom themes, make sure that these does not set the font in the viewer pane as white.

Resources