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

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

Related

mapdeck R when using fill_colour the session crashes in Rstudio

As the title says when I use the fill_colour parameter my session crashes.
For example if I take from the Colours section of the mapdeck site and run
library(mapdeck)
library(sf)
sf <- spatialwidget::widget_melbourne
mapdeck() %>%
add_polygon(
data = sf
, fill_colour = "SA2_NAME"
)
Then the system crashes with "R Session Aborted"
If I amend the above to just
library(mapdeck)
library(sf)
sf <- spatialwidget::widget_melbourne
mapdeck() %>%
add_polygon(
data = sf
)
then the plot comes out without an error.
If I go to the logs from the help menu in Rstudio then there's nothing about the crash.
What should I be checking, removing, reinstalling, etc?
sessionInfo()
R version 4.2.0 (2022-04-22 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8 LC_MONETARY=English_United States.utf8 LC_NUMERIC=C
[5] LC_TIME=English_United States.utf8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] units_0.8-0 dplyr_1.0.9 jsonify_1.2.1 RColorBrewer_1.1-3 sf_1.0-8 mapdeck_0.3.4 stringr_1.4.0 arrow_8.0.0
[9] webshot2_0.1.0 ggplot2_3.3.6 glue_1.6.2 magrittr_2.0.3 flextable_0.7.0 data.table_1.14.2 lubridate_1.8.0
loaded via a namespace (and not attached):
[1] Rcpp_1.0.8.3 class_7.3-20 ps_1.7.0 assertthat_0.2.1 digest_0.6.29 utf8_1.2.2 R6_2.5.1 evaluate_0.15
[9] e1071_1.7-9 pillar_1.7.0 gdtools_0.2.4 rlang_1.0.2 uuid_1.1-0 rmarkdown_2.14 htmlwidgets_1.5.4 bit_4.0.4
[17] munsell_0.5.0 proxy_0.4-26 compiler_4.2.0 xfun_0.31 pkgconfig_2.0.3 systemfonts_1.0.4 base64enc_0.1-3 htmltools_0.5.2
[25] spatialwidget_0.2.3 websocket_1.4.1 tidyselect_1.1.2 tibble_3.1.7 fansi_1.0.3 crayon_1.5.1 withr_2.5.0 later_1.3.0
[33] grid_4.2.0 jsonlite_1.8.0 gtable_0.3.0 lifecycle_1.0.1 DBI_1.1.2 scales_1.2.0 KernSmooth_2.23-20 zip_2.2.0
[41] cli_3.3.0 stringi_1.7.6 promises_1.2.0.1 xml2_1.3.3 ellipsis_0.3.2 generics_0.1.2 vctrs_0.4.1 tools_4.2.0
[49] bit64_4.0.5 officer_0.4.2 purrr_0.3.4 processx_3.5.3 fastmap_1.1.0 yaml_2.3.5 chromote_0.1.0 colorspace_2.0-3
[57] classInt_0.4-3 knitr_1.39

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.

Getting the Error: Graphics API version mismatch

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

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.

fable::ARIMA produces only NULL model

Issue
I am trying to produce forecasts using regression models with ARIMA errors, but they always fail to produce anything other than a NULL model; in contrast, TSLM models work just fine on the same data.
Looking for an answer, I found this question on applying models to multiple time-series and tried to reproduce Rob Hyndman's example (copy-paste the code in rstudio cloud).
It didn't work (details below).
What's wrong?
Code
library(tidyverse)
library(tsibble)
library(fable)
library(lubridate)
set.seed(1)
ar1 <- arima.sim(model=list(ar=.6), n=30)
ma1 <- arima.sim(model=list(ma=0.4), n=30)
Date <- ymd(paste0("2019-01-",1:30))
tb <- bind_cols(Date=Date, ar1=ar1, ma1=ma1) %>%
gather("Series", "value", -Date) %>%
as_tsibble(index=Date, key=Series)
tb
tb_all <- tb %>% model(arima = ARIMA(value))
tb_all
Output
# A mable: 2 x 2
# Key: Series [2]
Series arima
<chr> <model>
1 ar1 <NULL model>
2 ma1 <NULL model>
Session Info (on rstudio cloud)
R version 4.0.0 (2020-04-24)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.6 LTS
Matrix products: default
BLAS: /usr/lib/atlas-base/atlas/libblas.so.3.0
LAPACK: /usr/lib/atlas-base/atlas/liblapack.so.3.0
locale:
[1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8
[4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8
[7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] lubridate_1.7.8 gridtext_0.1.1 ggtext_0.1.0 forcats_0.5.0 stringr_1.4.0
[6] dplyr_0.8.5 purrr_0.3.4 tidyr_1.1.0 tibble_3.0.1 ggplot2_3.3.0
[11] tidyverse_1.3.0 patchwork_1.0.0 zoo_1.8-8 tsibble_0.8.6 feasts_0.1.3
[16] fable_0.2.0 fabletools_0.1.3 janitor_2.0.1 eurostat_3.6.1 scales_1.1.1
[21] readr_1.3.1 here_0.1 devtools_2.3.0 usethis_1.6.1 pacman_0.5.1
loaded via a namespace (and not attached):
[1] nlme_3.1-147 fs_1.4.1 sf_0.9-3 RColorBrewer_1.1-2
[5] httr_1.4.1 rprojroot_1.3-2 tools_4.0.0 backports_1.1.7
[9] utf8_1.1.4 R6_2.4.1 KernSmooth_2.23-16 DBI_1.1.0
[13] colorspace_1.4-1 withr_2.2.0 sp_1.4-2 tidyselect_1.1.0
[17] prettyunits_1.1.1 processx_3.4.2 curl_4.3 compiler_4.0.0
[21] rvest_0.3.5 cli_2.0.2 xml2_1.3.2 desc_1.2.0
[25] classInt_0.4-3 callr_3.4.3 digest_0.6.25 pkgconfig_2.0.3
[29] bibtex_0.4.2.2 sessioninfo_1.1.1 dbplyr_1.4.4 rlang_0.4.6
[33] readxl_1.3.1 rstudioapi_0.11 generics_0.0.2 jsonlite_1.6.1
[37] magrittr_1.5 Rcpp_1.0.4.6 munsell_0.5.0 fansi_0.4.1
[41] RefManageR_1.2.12 lifecycle_0.2.0 stringi_1.4.6 snakecase_0.11.0
[45] pkgbuild_1.0.8 plyr_1.8.6 grid_4.0.0 blob_1.2.1
[49] slider_0.1.3 crayon_1.3.4 lattice_0.20-41 haven_2.3.0
[53] hms_0.5.3 knitr_1.28 anytime_0.3.7 ps_1.3.3
[57] pillar_1.4.4 pkgload_1.0.2 reprex_0.3.0 glue_1.4.1
[61] remotes_2.1.1 modelr_0.1.8 vctrs_0.3.0 cellranger_1.1.0
[65] testthat_2.3.2 gtable_0.3.0 assertthat_0.2.1 xfun_0.14
[69] broom_0.5.6 countrycode_1.2.0 e1071_1.7-3 class_7.3-16
[73] warp_0.1.0 memoise_1.1.0 units_0.6-6 ellipsis_0.3.1
manually installed package urca

Resources