When running sessionInfo() in Rstudio I get
R version 4.2.1 (2022-06-23)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Monterey 12.5.1
Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib
locale:
[1] de_DE.UTF-8/de_DE.UTF-8/de_DE.UTF-8/C/de_DE.UTF-8/de_DE.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] lubridate_1.8.0 fansi_1.0.3 assertthat_0.2.1 utf8_1.2.2 dplyr_1.0.10 R6_2.5.1 DBI_1.1.3 lifecycle_1.0.2 magrittr_2.0.3
[10] pillar_1.8.1 stringi_1.7.8 rlang_1.0.5 cli_3.4.0 rstudioapi_0.14 snakecase_0.11.0 vctrs_0.4.1 generics_0.1.3 tools_4.2.1
[19] stringr_1.4.1 glue_1.6.2 purrr_0.3.4 janitor_2.1.0 compiler_4.2.1 pkgconfig_2.0.3 tidyselect_1.1.2 tibble_3.1.8
When running the same on an R-session started in the terminal via R I get
R version 4.2.1 (2022-06-23)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur ... 10.16
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib
locale:
[1] de_DE.UTF-8/de_DE.UTF-8/de_DE.UTF-8/C/de_DE.UTF-8/de_DE.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.2.1
As you can see the outputs differ:
RStudio says it's Monterey (which is correct), cli says it's Big Sur.
BLAS is missing
different packages are loaded via namespace
Both use the same .libPaths().
There's only one R in the path at /usr/local/bin/R.
This behaviour occurs on two different Macs, both with Monterey and R 4.2.1.
So why are the sessions different?
The running component is a copy of the utils::osVersion variable value. As explained in ?sessionInfo, that is set to the value used when R was compiled, which is typically 10.16 on Intel Macs.
Presumably RStudio and R.app replace that value with a correct one when run, but command line R doesn't.
If you build R yourself under Monterey, you'll see the correct value.
Regarding the packages loaded: RStudio loads a bunch of packages to support its API.
Regarding BLAS: I don't know, but it could be similar to the running issue, i.e. the front-end changed it.
Related
I have ggplot2 3.4.0 installed on Ubuntu 22.04, but for some reasons I would like to use older version ggplot2 3.3.6.
library(ggplot2, lib.loc="~/R/ggplot336/")
I worked fine when I started with a clean script file. However, when I use an existing script file like:
library(ggplot2, lib.loc="~/R/ggplot336/")
ggimage::geom_image()
I got the following error massage:
Error in value[3L] :
Package ‘ggplot2’ version 3.4.0 cannot be unloaded:
Error in unloadNamespace(package) : namespace ‘ggplot2’ is imported by ‘ggfun’, ‘ggplotify’, ‘ggimage’ so cannot be unloaded
Edit
Fresh start Rstudio
Open my R script file with following 3 lines:
sessionInfo()
library(ggplot2, lib.loc="~/R/ggplot336/")
ggimage::geom_image()
When I run the first line, sessionInfo() before doing anything else. We can see ggplot2_3.4.0 there. Could this be a Rstudio feature or an issue?
R version 4.2.2 Patched (2022-11-10 r83330)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.1 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0
locale:
[1] LC_CTYPE=en_AU.UTF-8 LC_NUMERIC=C LC_TIME=en_AU.UTF-8
[4] LC_COLLATE=en_AU.UTF-8 LC_MONETARY=en_AU.UTF-8 LC_MESSAGES=en_AU.UTF-8
[7] LC_PAPER=en_AU.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_AU.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] Rcpp_1.0.9 highr_0.9 pillar_1.8.1 compiler_4.2.2
[5] R.utils_2.12.2 R.methodsS3_1.8.2 yulab.utils_0.0.5 tools_4.2.2
[9] digest_0.6.30 evaluate_0.18 jsonlite_1.8.3 lifecycle_1.0.3
[13] tibble_3.1.8 gtable_0.3.1 ggimage_0.3.1 R.cache_0.16.0
[17] pkgconfig_2.0.3 rlang_1.0.6 reprex_2.0.2 DBI_1.1.3
[21] cli_3.4.1 ggplotify_0.1.0 rstudioapi_0.14 magick_2.7.3
[25] yaml_2.3.6 xfun_0.35 fastmap_1.1.0 knitr_1.41
[29] withr_2.5.0 dplyr_1.0.10 styler_1.8.1 generics_0.1.3
[33] vctrs_0.5.1 fs_1.5.2 gridGraphics_0.5-1 grid_4.2.2
[37] tidyselect_1.2.0 glue_1.6.2 R6_2.5.1 processx_3.8.0
[41] fansi_1.0.3 rmarkdown_2.18 clipr_0.8.0 callr_3.7.3
[45] ggplot2_3.4.0 purrr_0.3.5 magrittr_2.0.3 ps_1.7.2
[49] htmltools_0.5.3 scales_1.2.1 assertthat_0.2.1 colorspace_2.0-3
[53] utf8_1.2.2 munsell_0.5.0 ggfun_0.0.9 R.oo_1.25.0
It looks like R studio is loading in all of the previous libraries from a previous session. Maybe something leftover in .RData or .Rhistory. A fresh start of R should have far few loaded libraries.
Here is my fresh start:
sessionInfo()
R version 4.2.2 (2022-10-31)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Monterey 12.6.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
loaded via a namespace (and not attached):
[1] compiler_4.2.2 tools_4.2.2
In Rstudio's preference you should see this screen:
I would try unchecking all of the boxes and then quit and restart Rstudio to see if that clears up the problem.
After some experiments, I kind of worked out the problem. Since this has consumed so much time of my time, I thought this could be helpful to others.
The problem is :: (double colon) with packages using ggplot2, such as ggimage in my example. It appears that RStudio automatically load some dependent packages when a script file is open. One way to fix this problem for my work now is to remove ::, but use library() then function (geom_image) instead.
This fixed my problem but I still don't understand why RStudio behaves this way.
If :: (double colon) is necessary, comment lines containing ::, then after loading older version of ggplot2, uncomment those lines. A little awkward, but it works for me.
sessionInfo()
R version 4.2.1 (2022-06-23)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Monterey 12.3
Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2-arm64/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
loaded via a namespace (and not attached):
[1] compiler_4.2.1 fastmap_1.1.0 cli_3.3.0 htmltools_0.5.3 tools_4.2.1 yaml_2.3.5
[7] rmarkdown_2.14 gdata_2.18.0.1 knitr_1.39 xfun_0.31 digest_0.6.29 rlang_1.0.2
[13] gtools_3.9.3 evaluate_0.15
I have an issue where RMarkdowns stop knitting (without error) when encountering chunks with graphics/plots.
I experience this issue even with the default RMarkdown with summary(cars) and plot(pressure). However, when I comment out the plot(pressure) chunk, the .html file is rendered successfully and I get an output instantaneously.
I was getting the following error as well:
Error in .rs.parsePackageDependencies(contents, extension) :
object 'partition_yaml_front_matter' not found
and I tried remotes::install_version("rlang", "1.0.2") as suggested here:
https://github.com/rstudio/rstudio/issues/11552
But that hasn't solved this issue.
Any help or tips appreciated...
My website used to work fine in my previous laptop, which used R 3.6.3. In my new laptop when I run blogdown::serve_site() I get the error Error in !server$daemon : invalid argument type. I tried doing what was suggested here but didn't help.
Here is the session info:
R version 4.1.0 (2021-05-18)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 11.2.3
Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib
locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] Rcpp_1.0.6 bookdown_0.22 digest_0.6.27 later_1.2.0 R6_2.5.0
[6] jsonlite_1.7.2 magrittr_2.0.1 evaluate_0.14 blogdown_1.3.2 rlang_0.4.11
[11] rstudioapi_0.13 promises_1.2.0.1 rmarkdown_2.9 tools_4.1.0 servr_0.22
[16] httpuv_1.6.1 xfun_0.24 yaml_2.2.1 compiler_4.1.0 htmltools_0.5.1.1
[21] knitr_1.33
This is the website link and you can find the Github repo here.
You should remove the quotes on interactive(). It should be
servr.daemon = interactive()
instead of
servr.daemon = "interactive()"
Actually servr.daemon = interactive() is the default, so you don't really need to set it explicitly (i.e., you can remove this setting).
I want to use warp function from terra package, but it seems the function is not available in my terra library. Is this a bug? Or could it relate to system gdal installation? I have not installed gdal outside R.
Edit: After more workaround I guess function terra::warp was in newer version renamed to terra::resample. So, there is maybe just inconsistency in help.
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=Czech_Czechia.1250 LC_CTYPE=Czech_Czechia.1250 LC_MONETARY=Czech_Czechia.1250
[4] LC_NUMERIC=C LC_TIME=Czech_Czechia.1250
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] terra_0.8-8 rgdal_1.5-16 landmap_0.0.3 raster_3.3-13 sp_1.4-2
loaded via a namespace (and not attached):
[1] compiler_4.0.2 tools_4.0.2 yaml_2.2.1 Rcpp_1.0.5 codetools_0.2-16 grid_4.0.2
[7] lattice_0.20-41
Instead of a single warp method, terra has resample and project. With resample primarily to transform raster data to another resolution . This is for cases where this cannot be done with (dis)-aggregate --- which would otherwise be preferred. And with project primarily for transforming the data to another coordinate reference system.
I have installed R many time in the last two decades. Today for the first time something went wrong.
After installing on a brand new laptop with windows 10 pro, I get this warning every time I open the program:
During startup - Warning message:
Setting LC_CTYPE= failed
I tried reading about this, but all I could find was MAC related, I have a lenovo thinkpad with windows 10.
Edit: Session Info
R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] sessioninfo_1.1.1
loaded via a namespace (and not attached):
[1] compiler_3.5.1 assertthat_0.2.0 cli_1.0.1 tools_3.5.1 withr_2.1.2
[6] rstudioapi_0.8 yaml_2.2.0 crayon_1.3.4