Getting the Error: Graphics API version mismatch - r

I'm getting the following error when I run shiny:
Error: Graphics API version mismatch
Listening on http://127.0.0.1:3774
Warning: Error in Cairo: Graphics API version mismatch
[No stack trace available]
Any idea how to fix it.
My session information is below:
sessionInfo()
R version 4.1.1 (2021-08-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.2 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
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods
[7] base
other attached packages:
[1] leaflet_2.0.4.1 tidytable_0.6.4 forcats_0.5.1
[4] stringr_1.4.0 dplyr_1.0.7 purrr_0.3.4
[7] readr_2.0.1 tidyr_1.1.3.9000 tibble_3.1.3
[10] ggplot2_3.3.5 tidyverse_1.3.1 ggvis_0.4.7
[13] shiny_1.6.0 rpivotTable_0.3.0
loaded via a namespace (and not attached):
[1] Rcpp_1.0.7 lubridate_1.7.10
[3] assertthat_0.2.1 digest_0.6.27
[5] utf8_1.2.2 mime_0.11
[7] R6_2.5.0 cellranger_1.1.0
[9] backports_1.2.1 reprex_2.0.1
[11] httr_1.4.2 pillar_1.6.2
[13] rlang_0.4.11 readxl_1.3.1
[15] rstudioapi_0.13 data.table_1.14.0
[17] jquerylib_0.1.4 htmlwidgets_1.5.3
[19] munsell_0.5.0 broom_0.7.9
[21] compiler_4.1.1 httpuv_1.6.1
[23] modelr_0.1.8 xfun_0.25
[25] pkgconfig_2.0.3 htmltools_0.5.1.1
[27] tidyselect_1.1.1.9000 fansi_0.5.0
[29] crayon_1.4.1 tzdb_0.1.2
[31] dbplyr_2.1.1 withr_2.4.2
[33] later_1.2.0 grid_4.1.1
[35] jsonlite_1.7.2 xtable_1.8-4
[37] gtable_0.3.0 lifecycle_1.0.0
[39] DBI_1.1.1 magrittr_2.0.1
[41] scales_1.1.1 cachem_1.0.5
[43] cli_3.0.1 stringi_1.7.3
[45] fs_1.5.0 promises_1.2.0.1
[47] bslib_0.2.5.1 xml2_1.3.2
[49] ellipsis_0.3.2 generics_0.1.0
[51] vctrs_0.3.8 Cairo_1.5-12.2
[53] tools_4.1.1 glue_1.4.2
[55] hms_1.1.0 crosstalk_1.1.1
[57] rsconnect_0.8.24 yaml_2.2.1
[59] fastmap_1.1.0 colorspace_2.0-2
[61] rvest_1.0.1 knitr_1.33
[63] haven_2.4.3 sass_0.4.0

Starting with R 4.1.0 the graphics engine version has been upgraded. I suspect that may cause the error.
The R News for 4.1.0 state:
The graphics engine version, R_GE_version, has been bumped to 14 and so packages that provide graphics devices should be reinstalled.
So maybe re-installing the Cairo package solves the issue.

I got this error using ggsave. I fixed it by removing and re-installing the package ragg. The version remained at 1.2.2 but now worked. I am using RStudio 2022.07.1 with R version 4.2.1

Related

dimdesc() error from FactoMineR package in the building of PCA

Using the data available on FactoMineR package: (http://factominer.free.fr/book/orange.csv), I created a PCA and after a PCA with supplementary information. The latter step when I used the function dimdesc() I obtained an error that surfing through internet I was not able to find a way to solve it.
I post here if someone could help me. I attach below my code. Thanks on advance for your comments/hints.
data_orange<-read.delim("orange.csv", header = T, sep = ";")
data_orange_subset <- data_orange[,1:8]
res.pca<-PCA(data_orange_subset, graph = F)
dimdesc(res.pca,axes=1:2)
--> This works
When considering supplementary information in the PCA:
data_orange_2 <- data_orange[,-c(16,17)]
res.pca.all <- PCA(data_orange_2, graph = F,
quanti.sup = 9:15,
quali.sup = 1)
dimdesc(res.pca.all, axes = 1:2)
Error in if (sum(tabF[, 2] <= proba) > 0) resF <- tabF[tabF[, 2] <= proba, :
missing value where TRUE/FALSE needed
I've checked for NA values in dataframe but it is not the case.
SessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux Mint 19.1
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1
locale:
[1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C LC_TIME=en_GB.UTF-8
[4] LC_COLLATE=en_GB.UTF-8 LC_MONETARY=es_ES.UTF-8 LC_MESSAGES=en_GB.UTF-8
[7] LC_PAPER=es_ES.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=es_ES.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] factoextra_1.0.7.999 ggplot2_3.3.6 FactoMineR_2.4
loaded via a namespace (and not attached):
[1] ggrepel_0.9.1 Rcpp_1.0.8.3 lattice_0.20-45 tidyr_1.2.0
[5] assertthat_0.2.1 digest_0.6.29 utf8_1.2.2 R6_2.5.1
[9] backports_1.4.1 evaluate_0.15 pillar_1.7.0 rlang_1.0.3
[13] rstudioapi_0.13 minqa_1.2.4 car_3.1-0 nloptr_2.0.3
[17] Matrix_1.4-1 DT_0.23 rmarkdown_2.13 labeling_0.4.2
[21] splines_4.1.2 lme4_1.1-29 htmlwidgets_1.5.4 munsell_0.5.0
[25] broom_0.8.0 compiler_4.1.2 xfun_0.31 pkgconfig_2.0.3
[29] faraway_1.0.7 htmltools_0.5.2 flashClust_1.01-2 tidyselect_1.1.2
[33] tibble_3.1.7 gridExtra_2.3 dendextend_1.15.2 viridisLite_0.4.0
[37] fansi_1.0.3 crayon_1.5.1 dplyr_1.0.9 withr_2.5.0
[41] ggpubr_0.4.0 MASS_7.3-56 leaps_3.1 grid_4.1.2
[45] nlme_3.1-157 gtable_0.3.0 lifecycle_1.0.1 DBI_1.1.2
[49] magrittr_2.0.3 scales_1.2.0 cli_3.3.0 carData_3.0-5
[53] farver_2.1.0 ggsignif_0.6.3 viridis_0.6.2 scatterplot3d_0.3-41
[57] ellipsis_0.3.2 generics_0.1.2 vctrs_0.4.1 boot_1.3-28
[61] ggsci_2.9 tools_4.1.2 glue_1.6.2 purrr_0.3.4
[65] abind_1.4-5 fastmap_1.1.0 yaml_2.3.5 colorspace_2.0-3
[69] cluster_2.1.3 rstatix_0.7.0 knitr_1.39

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

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.

true-false questions in exams R package

I am trying to build a true-false question in exams R package. It is a single choice exercise with only two possible answers in the Answerlist. Here is the code:
Question
========
¿Puede una variable clasificarse como cualitativa continua?
Answerlist
----------
* Si
* No
Solution
========
No es posible ya que una variable continua debe ser nesezariamente una variable cuantitativa.
Answerlist
----------
* False
* True
Meta-information
================
exname: Escalas de medicion 01
extype: schoice
exsolution: 01
exshuffle: 2
After runing exams2html(question.Rmd) the output have three posible answers including NA
I am doing anything wrong?
Session info:
> sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.4 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=es_CO.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=es_CO.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=es_CO.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=es_CO.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] forcats_0.5.0 stringr_1.4.0 dplyr_1.0.0 purrr_0.3.4
[5] readr_1.3.1 tidyr_1.1.0 tibble_3.0.3 ggplot2_3.3.2
[9] tidyverse_1.3.0 exams_2.3-6 pacman_0.5.1
loaded via a namespace (and not attached):
[1] Rcpp_1.0.5 cellranger_1.1.0 pillar_1.4.6 compiler_4.0.2
[5] dbplyr_1.4.4 tools_4.0.2 jsonlite_1.7.0 lubridate_1.7.9
[9] lifecycle_0.2.0 gtable_0.3.0 pkgconfig_2.0.3 rlang_0.4.7
[13] reprex_0.3.0 cli_2.0.2 rstudioapi_0.11 DBI_1.1.0
[17] haven_2.3.1 withr_2.2.0 xml2_1.3.2 httr_1.4.2
[21] fs_1.4.2 generics_0.0.2 vctrs_0.3.2 hms_0.5.3
[25] grid_4.0.2 tidyselect_1.1.0 glue_1.4.1 R6_2.4.1
[29] fansi_0.4.1 readxl_1.3.1 modelr_0.1.8 blob_1.2.1
[33] magrittr_1.5 backports_1.1.8 scales_1.1.1 ellipsis_0.3.1
[37] rvest_0.3.5 assertthat_0.2.1 colorspace_1.4-1 stringi_1.4.6
[41] munsell_0.5.0 broom_0.7.0 crayon_1.3.4
Fixed the issue by setting the
exshuffle: TRUE
This was a bug in the exams package that only occurred under certain circumstances. It has been fixed in version 2.4-0 of the package.

Warning in install.packages: converting NULL pointer to R NULL

I just upgraded to R 4.0.0 and I am now trying to reinstall the packages I use. But when I try to do so in RStudio, I have the following warning:
Warning in install.packages: converting NULL pointer to R NULL
I also had this sort of warning later when running a shiny app:
Warning in .Call("rs_registerShinyFunction", params): converting NULL pointer to R NULL
Where does this come from? How can I fix it?
If needed:
> sessionInfo()
R version 4.0.0 (2020-04-24)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.4 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1
locale:
[1] LC_CTYPE=fr_FR.UTF-8 LC_NUMERIC=C
[3] LC_TIME=fr_FR.UTF-8 LC_COLLATE=fr_FR.UTF-8
[5] LC_MONETARY=fr_FR.UTF-8 LC_MESSAGES=fr_FR.UTF-8
[7] LC_PAPER=fr_FR.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] shiny_1.4.0.2 hammer_0.0.0.9000 testthat_2.3.2
loaded via a namespace (and not attached):
[1] xfun_0.13 remotes_2.1.1 shinyjs_1.1 purrr_0.3.4
[5] miniUI_0.1.1.1 htmltools_0.4.0 usethis_1.6.1 yaml_2.2.1
[9] rlang_0.4.6 pkgbuild_1.0.8 later_1.0.0 glue_1.4.0
[13] withr_2.2.0 stringr_1.4.0 htmlwidgets_1.5.1 knitr_1.28
[17] callr_3.4.3 fastmap_1.0.1 golem_0.2.1 httpuv_1.5.2
[21] ps_1.3.3 fansi_0.4.1 Rcpp_1.0.4.6 xtable_1.8-4
[25] promises_1.1.0 backports_1.1.6 DT_0.13 shinyhelper_0.3.2
[29] desc_1.2.0 pkgload_1.0.2 jsonlite_1.6.1 config_0.3
[33] mime_0.9 fs_1.4.1 packrat_0.5.0 digest_0.6.25
[37] stringi_1.4.6 processx_3.4.2 stargazer_5.2.2 rprojroot_1.3-2
[41] here_0.1 cli_2.0.2 tools_4.0.0 dockerfiler_0.1.3
[45] magrittr_1.5 crayon_1.3.4 xml2_1.3.2 prettyunits_1.1.1
[49] shinyBS_0.61 attempt_0.3.1 assertthat_0.2.1 roxygen2_7.1.0
[53] rstudioapi_0.11 R6_2.4.1 compiler_4.0.0
Updating to the last Rstudio version (at least 1.2.5042) fixes the problem. It was noticed in this issue on Github.
To avoid incompatibilities with the new R major version, it might be a good idea to reinstall all the packages with:
installed <- installed.packages()[,1]
install.packages(installed)
This source recommends to install the packages with
Rscript -e 'install.packages(...)'
on the command line instead of RStudio. It seems to be something RStudio-specific.

Resources