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.
Related
I want to install additional packages besides the default ones every time I restart my R Session.
I have tried this: options(HTTPUserAgent = sprintf("R/%s R (%s)", getRversion(), paste(getRversion(), R.version$platform, R.version$arch, R.version$os)))
install.packages(c(
'shinydashboard',
'shinyWidgets',
'rlist',
'sortable',
'tidyverse',
'XML',
'DescTools',
'plotly',
'leaflet',
'tidyquant',
'umap'
))
And this options(defaultPackages = c(getOption("defaultPackages"), "tidyquant", ...)) neither of which works. If all I want to do is to install the tidyquant package upon the R Session restart, how do I get it to work inside the Rprofile file?
I would definitely take #dirk-eddelbuettel's advice on this (XY problem), but it is possible if you add this to your .Rprofile:
.First <- function(){
utils::install.packages("tidyquant", repos="https://cran.csiro.au/")
library(tidyquant)
}
(This command is run before any packages are loaded so you need to specify the install.packages function comes from utils).
Not sure if this applies to windows; my system info:
> sessionInfo()
R version 4.1.3 (2022-03-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Monterey 12.4
Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib
locale:
[1] en_AU.UTF-8/en_AU.UTF-8/en_AU.UTF-8/C/en_AU.UTF-8/en_AU.UTF-8
attached base packages:
[1] graphics grDevices utils datasets stats methods
[7] base
other attached packages:
[1] tidyquant_1.0.4 quantmod_0.4.20
[3] TTR_0.24.3 PerformanceAnalytics_2.0.4
[5] xts_0.12.1 zoo_1.8-10
[7] lubridate_1.8.0
loaded via a namespace (and not attached):
[1] magrittr_2.0.3 tidyselect_1.1.2 munsell_0.5.0
[4] colorspace_2.0-3 lattice_0.20-45 R6_2.5.1
[7] rlang_1.0.2 quadprog_1.5-8 fansi_1.0.3
[10] dplyr_1.0.9 httr_1.4.3 tcltk_4.1.3
[13] tools_4.1.3 grid_4.1.3 gtable_0.3.0
[16] utf8_1.2.2 DBI_1.1.2 cli_3.3.0
[19] ellipsis_0.3.2 assertthat_0.2.1 tibble_3.1.7
[22] lifecycle_1.0.1 crayon_1.5.1 purrr_0.3.4
[25] ggplot2_3.3.6 vctrs_0.4.1 curl_4.3.2
[28] Quandl_2.11.0 glue_1.6.2 compiler_4.1.3
[31] pillar_1.7.0 generics_0.1.2 scales_1.2.0
[34] jsonlite_1.8.0 pkgconfig_2.0.3
>
N.B. Choose your CRAN mirror accordingly (unless you also happen to be in Australia): https://cran.r-project.org/mirrors.html
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
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.
I recently installed both R and RStudio on a new computer, and wanted to create an RProject. I used to use the package renv before and it worked pretty well so far.
However, when I tried to initialize the renv library it first created all the necessary folders within the Rproject, but then suddenly gives th following error:
Fehler in data[[1]] . Indizierung ausserhalb der Grenzen
Afterwards it says: Fataler Fehler: unable to initialize the JIT
And finally produces a fatal error and collapses.
I already un- and reinstalled both R and RStudio twice, but without success.
Any ideas?
R version 3.6.3 (2020-02-29)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)
Matrix products: default
locale:
[1] LC_COLLATE=German_Switzerland.1252 LC_CTYPE=German_Switzerland.1252 LC_MONETARY=German_Switzerland.1252
[4] LC_NUMERIC=C LC_TIME=German_Switzerland.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] Rcpp_1.0.5 plyr_1.8.6 compiler_3.6.3 pillar_1.4.3 later_1.0.0 shinyjs_1.1
[7] tools_3.6.3 digest_0.6.25 viridisLite_0.3.0 jsonlite_1.7.0 lifecycle_0.1.0 tibble_2.1.3
[13] gtable_0.3.0 pkgconfig_2.0.3 rlang_0.4.7 shiny_1.4.0 DBI_1.1.0 rstudioapi_0.11
[19] crosstalk_1.0.0 RPostgreSQL_0.6-2 yaml_2.2.1 xfun_0.12 fastmap_1.0.1 stringr_1.4.0
[25] httr_1.4.1 dplyr_0.8.4 vctrs_0.2.3 htmlwidgets_1.5.1 DT_0.12 tidyselect_1.0.0
[31] leaflet_2.0.3 grid_3.6.3 data.table_1.12.8 glue_1.3.1 R6_2.4.1 plotly_4.9.2
[37] reshape2_1.4.3 tidyr_1.0.2 purrr_0.3.3 ggplot2_3.2.1 magrittr_1.5 shinycssloaders_0.3
[43] scales_1.1.0 promises_1.1.0 htmltools_0.5.0 assertthat_0.2.1 mime_0.9 xtable_1.8-4
[49] colorspace_1.4-1 httpuv_1.5.2 config_0.3 tinytex_0.20 stringi_1.4.6 lazyeval_0.2.2
[55] munsell_0.5.0 crayon_1.3.4 ```
I am trying to upload several rasters on tif format with google-collaboration. However I always had the same error message:
"Cannot create RasterLayer object from this file; perhaps you need to install rgdal first"
So, I tried to install rgdal...and another error appeared:
"Installation of package had non-zero exit status."
I tried to install using a local file, and apparently, its run ok, however, when i required the package, another error appeared:
"Error in library(rgdal) : there is no package called ‘rgdal’
/usr/local/lib/python3.6/dist-packages/rpy2/rinterface/init.py:146: RRuntimeWarning: 4:
warnings.warn(x, RRuntimeWarning)
/usr/local/lib/python3.6/dist-packages/rpy2/rinterface/init.py:146: RRuntimeWarning: 5:
warnings.warn(x, RRuntimeWarning)
/usr/local/lib/python3.6/dist-packages/rpy2/rinterface/init.py:146: RRuntimeWarning: 6: package ‘rgdal’ is not available (for R version 3.6.1)"
Could anyone help me to fix these errors?
I provide my session info and a fragment of code
R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.2 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas/liblapack.so.3
Random number generation:
RNG: Mersenne-Twister
Normal: Inversion
Sample: Rounding
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] parallel tools stats graphics grDevices utils datasets
[8] methods base
other attached packages:
[1] snowfall_1.84-6.1 snow_0.4-3 biomod2_3.3-7.1 ggplot2_3.2.1
[5] reshape_0.8.8 raster_2.9-23 sp_1.3-1
loaded via a namespace (and not attached):
[1] gbm_2.1.5 zoo_1.8-6 tidyselect_0.2.5
[4] purrr_0.3.2 splines_3.6.1 lattice_0.20-38
[7] colorspace_1.4-1 viridisLite_0.3.0 survival_2.44-1.1
[10] rlang_0.4.0 hexbin_1.27.3 pillar_1.4.2
[13] glue_1.3.1 withr_2.1.2 RColorBrewer_1.1-2
[16] plotmo_3.5.5 plyr_1.8.4 mda_0.4-10
[19] munsell_0.5.0 gtable_0.3.0 codetools_0.2-16
[22] latticeExtra_0.6-28 class_7.3-15 Rcpp_1.0.2
[25] scales_1.0.0 plotrix_3.7-6 abind_1.4-5
[28] gridExtra_2.3 TeachingDemos_2.10 dplyr_0.8.3
[31] dismo_1.1-4 rasterVis_0.46 grid_3.6.1
[34] magrittr_1.5 lazyeval_0.2.2 tibble_2.1.3
[37] PresenceAbsence_1.1.9 randomForest_4.6-14 Formula_1.2-3
[40] crayon_1.3.4 pkgconfig_2.0.2 MASS_7.3-51.4
[43] Matrix_1.2-17 pROC_1.15.3 assertthat_0.2.1
[46] earth_5.1.1 R6_2.4.0 rpart_4.1-15
[49] nnet_7.3-12 compiler_3.6.1
%load_ext rpy2.ipython
from google.colab import drive
drive.mount('/content/drive/')
%%R
install.packages("rgdal", dependencies=TRUE,repos='http://cran.rstudio.com/')
library(rgdal)
library(raster)
myExpl.EUR <- stack(list.files("/content/drive/My Drive/Sycios/",pattern=".tif",full.names=TRUE))
Thank you very much in advance
Try this from the command line
sudo apt-get update
sudo apt-get install libgdal-dev libproj-dev
And then in R
install.packages("rgdal")