Install Rcartogram: error on R CMD INSTALL - r

I am trying to use the Rcartogram package. After following the instructions in the answer by Geoff, I received an error that I can't resolve:
C:\R\R-3.2.3\library\Rcartogram>R CMD INSTALL --debug .
processing '.'
a directory
* installing to library 'C:/R/R-3.2.3/library'
* build_help_types=
* DBG: 'R CMD INSTALL' now doing do_install()
* created lock directory 'C:/R/R-3.2.3/library/00LOCK-Rcartogram'
ERROR: cannot install to srcdir for package 'Rcartogram'
* removing C:/R/R-3.2.3/library/Rcartogram
I have tried running R CMD INSTALL in other directories, as well as changing the flags as suggested in the linked answer. They either return the same error, or an error that there is no packages specified. What can I do to debug this error?
sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
locale:
[1] LC_COLLATE=English_Australia.1252 LC_CTYPE=English_Australia.1252
[3] LC_MONETARY=English_Australia.1252 LC_NUMERIC=C
[5] LC_TIME=English_Australia.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] tools_3.2.3

Related

How do I install R packages from VSCode using global site-library

I'm having trouble installing R packages from VSCode using the R extension v5.2.3. The directory /usr/local/lib/R/site-library that VSCode is trying to write to is not writeable. This is the directory that is used when I start R as root and install R packages from the console. This is where I want my R packages to live.
This is the error I get when using VSCode to install the R package here. Note that I start VSCode as a normal user.
Executing task: /usr/bin/R --silent --slave -e install.packages(c('here'),repos='https://cloud.r-project.org/')
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
Warning in install.packages(c("here"), repos = "https://cloud.r-project.org/") :
'lib = "/usr/local/lib/R/site-library"' is not writable
Error in install.packages(c("here"), repos = "https://cloud.r-project.org/") :
unable to install packages
Execution halted
* The terminal process "/usr/bin/R '--silent', '--slave', '-e', 'install.packages(c('here'),repos='https://cloud.r-project.org/')'" failed to launch (exit code: 1).
* Terminal will be reused by tasks, press any key to close it.
This post describe the same error on windows. But with no solution...
So, is there a way to manage my R packages from VSCode using the global library /usr/local/lib/R/site-library?
My Linux info:
~$ uname -rvmpo
5.15.0-48-generic #54~20.04.1-Ubuntu SMP Thu Sep 1 16:17:26 UTC 2022 x86_64 x86_64 GNU/Linux
And the R ditto:
> sessionInfo()
R version 4.2.1 (2022-06-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux Mint 20.3
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/atlas/libblas.so.3.10.3
LAPACK: /usr/lib/x86_64-linux-gnu/atlas/liblapack.so.3.10.3
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=sv_SE.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=sv_SE.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=sv_SE.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.2.1

Permission denied on .dll file when installing package

New job gave me a fresh Windows laptop where I am struggling (to say the very least) to set up a fresh R environment. Specifically, when developing a package, the commmand Install and Restart exits abruptly due to permission issues on a specific .dll file.
==> Rcmd.exe INSTALL --no-multiarch --with-keep.source --install-tests curl
* installing to library 'C:/R/R-Library'
* installing *source* package 'curl' ...
ERROR: cannot remove earlier installation, is it in use?
* removing 'C:/R/R-Library/curl'
* restoring previous 'C:/R/R-Library/curl'
Warning in file.copy(lp, dirname(pkgdir), recursive = TRUE, copy.date = TRUE) :
problem copying C:\R\R-Library\00LOCK-curl\curl\libs\x64\curl.dll to C:\R\R-Library\curl\libs\x64\curl.dll: Permission denied
Exited with status 1.
As a first attempt to ameliorate the issue, I've moved both my R installation and library at C:/. This obviously seems not to be enough.
> .libPaths()
[1] "C:/R/R-Library" "C:/R/R-4.0.3/library"
> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)
Matrix products: default
locale:
[1] LC_COLLATE=Italian_Italy.1252 LC_CTYPE=Italian_Italy.1252 LC_MONETARY=Italian_Italy.1252 LC_NUMERIC=C
[5] LC_TIME=Italian_Italy.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.0.3 tools_4.0.3
I am kind of lost as to where to look next. As a last shot in the dark I've tried to run RStudio with Admin right with no luck.

Package 'xxx’ was installed before R 4.0.0: please re-install it (already done fresh install and checked lib paths)

I am having some issue with installing a package in R 4.0.2 from binaries. Here is my attempt:
> install.packages("C:/Users/MNestor/Downloads/libSBML_5.18.0.zip", repos = NULL, type = "win.binary")
Installing package into ‘C:/Users/MNestor/Documents/R/win-library/4.0’ (as ‘lib’ is unspecified)
package ‘libSBML’ successfully unpacked and MD5 sums checked
Warning messages:
1: multiple methods tables found for ‘type’
2: multiple methods tables found for ‘type<-’
Next I load library:
> library('libSBML')
Error: package or namespace load failed for ‘libSBML’:
package ‘libSBML’ was installed before R 4.0.0: please re-install it
This error is confusing to me because I am working in R 4.0.2 and have clearly just done a fresh install.
I have tried
deleting the library folder and reinstalling
running remove.packages('libSBML') and reinstalling
For reference here are my library directories:
> .libPaths()
[1] "C:/Users/MNestor/Documents/R/win-library/4.0"
[2] "C:/Program Files/R/R-4.0.2/library"
The libSMBL folder is located in the first library path, and not the second (as expected).
Here is session info:
> sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17134)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] parallel stats graphics grDevices utils datasets methods base
other attached packages:
[1] rsbml_2.46.0 BiocGenerics_0.34.0
loaded via a namespace (and not attached):
[1] BiocManager_1.30.10 compiler_4.0.2 tools_4.0.2 remotes_2.2.0
[5] stats4_4.0.2 SBMLR_1.84.0 graph_1.66.0
The error message is maybe a bit confusing, but it's saying the package is already compiled for an earlier version of R. (That's what the option "win.binary" means).
R 4.0 and earlier binaries are not compatible because of updated compilers and build tools.
You'll need to install the package from source, which likely means installing R tools (https://cran.r-project.org/bin/windows/Rtools/) or you'll need to use a version that is pre-built for R 4.0 or later.

Enable travis CI to check for package dependencies

Actual question
What do I need to do in order to enable travis CI to check my package dependencies?
What I tried
I tried adding the cran argument to .travis.yml file as describe in guide on travis-ci.com.
My .travis.yml file looks like this:
language: r
warnings_are_errors: yes
sudo: required
cran: http://cran.rstudio.com
r_packages:
- covr
after_success:
- Rscript -e 'covr::codecov()'
Yet, I still get the following error:
* checking package dependencies ... ERROR
No repository set, so cyclic dependency check skipped
Session info
> sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252
[3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
[5] LC_TIME=German_Germany.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] devops_0.1.2
loaded via a namespace (and not attached):
[1] magrittr_1.5 tools_3.2.2 yaml_2.1.13 memoise_0.2.1 stringi_1.0-1
[6] stringr_1.0.0 digest_0.6.8 devtools_1.9.1
Update
I found out that the error was actually cause by listing some package dependencies in Suggests: instead of Imports: section of my DESCRIPTION file (build that passed).
However, I'm still getting a note that the dependency check was skipped as no repository has been set:
* checking package dependencies ... NOTE
No repository set, so cyclic dependency check skipped
Does that mean that a dependency check has not been carried out and, if so, what do I need to change in order to make this happen?

Rterm.exe error in RStudio

I am using R 3.2.2 and RStudio 0.99.486 (latest version) under Windows 7 SP1 64 bit. I always get an error when I start RStudio:
the procedure entry point vsnprintf could not be
located in the dynamic link library R.dll
But I don't get any errors when I directly start R 3.2.2.
The R installed into C:/ProgramFiles/R/R-3.2.2/ (not the default path) and don't have other versions of R. RStudio is setup to use the installed R.
Except I get an error in RStudio, all my R codes can run in RGUI and RStudio.
Thanks for any suggestions to solve this annoying problem.
My session information
sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=English_Australia.1252 LC_CTYPE=English_Australia.1252
[3] LC_MONETARY=English_Australia.1252 LC_NUMERIC=C
[5] LC_TIME=English_Australia.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] tools_3.2.2
> .libPaths()

Resources