Installation of dependencies of R packages from local repository - r

Has the issue described here been resolved:
https://github.com/rstudio/packrat/issues/169
If not, does it mean that if I have a package [package_from_local_repo] installed by packrat from a local repository, its dependencies (although available in CRAN, etc) will not be installed?
Is a workaround to use library([missing dependency]) on the same R code that calls my [package_from_local_repo]?

Related

deployment on shinyapps.io failing

Hi I'm trying to deploy an app on the server, however, I get the following errors
* May be unable to deploy package dependency "rClr" could not
determine a repository URL for the source CRAN.
* May be unable to deploy package dependency "tlf" could not determine
a repository URL for the source CRAN.
Unable to determine the source location for some packages. Packages
should be installed from a package repository like CRAN or a version
control system. Check that options(repos) refers to a package
repository containing the needed package versions.
The backbone packages can not be installed from Cran and have to be done manually, hence the errors. How can this be fixed in order to deploy the app on the server?
Thanks for all help

R - Installing package with remotes::install_github ask for higher version of the dependencies which BiocManager::install() can not find

I need to install few packages that should be installed with remotes::install_github() like
"acidgenomics/basejump" or "satijalab/seurat".
During the installation, it need to upgrade few other packages version. The BiocManager::install program cannot find those versions and I had to install those dependencies packages version with:
R CMD INSTALL IRanges_2.20.2.tar.gz
Then other packages, that use the same packages stop working. like DESeq2,
I get the error:
Error: package or namespace load failed for ‘DESeq2’:
objects ‘rowSums’, ‘colSums’, ‘rowMeans’, ‘colMeans’ are not exported by 'namespace:S4Vectors'
I found few answers that say it happen (like url)
remotes::install_github() isn't picking up the correct Bioconductor
devel repos, whereas installing with BiocManager::install() does work
as expected.
we have the R 3.6.0 installed as a module and a lot of users uses the same R version. I need all packages to work for everyone.
How can I make all variety packages versions to work?
Finally, I install new version of R 3.6.3 with Bioconductor 3.10 and all the packages install right.

Error while installing package in RStudio

I'm not able to install the IntroCompFinR package in RStudio due to this error:
> install.packages("IntroCompFinR")
Installing package into ‘C:/Users/HP/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
Warning in install.packages :
package ‘IntroCompFinR’ is not available (for R version 3.6.1)
Try the R-Forge repo?
install.packages("IntroCompFinR", repos="http://R-Forge.R-project.org")
You may also have to install quadprog from another repo first.
install.packages("quadprog", repos="http://cran.rstudio.com")
install.packages("IntroCompFinR", repos="http://R-Forge.R-project.org")
install.packages("package_name") from devtools library works only when the package is enlisted in CRAN, and complies with your R version.
Three alternatives if it is available, but either not in CRAN or not compatible with your R version:
Install via Github: If your package is incorporated in a Github repository (most packages are), then you can use
install_github("github_UsernameOfAuthor/repository_name")
Other prominent repository holders include bitbucket and gitorious, for which
install_bitbucket("package_Author/repository_name")
and
install_gitorious("package_Author/repository_name")
apply respectively.
Install via R-Forge: If your repository is uploaded to R-Forge, you can use
install.packages("package_name", repos="http://R-Forge.R-project.org")
This is applicable in your case since there is an R-Forge repository for the IntroCompFinR library, with the install command being mentioned here as well.
Install via some other source URL/website: If your package has a repository somewhere on the internet, you can use the source-link to install the package via
install.packages("package_name", repos="URL")`.
Note: All of these commands are provided by devtools, which you seem to have, but just in case you don't, you can use these commands to install both devtools and your required package:
# Install directly from CRAN:
if(!require(devtools))install.packages("devtools")
devtools::install.packages("package_name")
# Install via Github:
if(!require(devtools))install.packages("devtools")
devtools::install_github("githubAuthor_username/package_name")
# Install via R-Forge or any other repository holding website:
if(!require(devtools))install.packages("devtools")
devtools::install.packages("package_name",repos="website-link")
Most package authors give installation commands in their package vignette or via their Github repository for the same, but you can acquire the package directly provided you know its name and link to the source repository.
You can use this post as a reference when installing R packages in the future.

How to use R CMD Install without dependencies check?

I'm running R CMD INSTALL --build package on a windows computer. My package imports a couple of other packages which themselves depend on some more packages. I have all dependencies installed in the local r_libs folder and everything works.
Now sometimes I have the my package source code on a different windows computer. On this computer I don't have all the dependency packages installed.
When I try to use R CMD INSTALL --build package, I get the obvious "ERROR: dependencies 'package a', 'package b', etc, are not available for package".
My question is: Can I build the package using R CMD INSTALL --build without the dependency checks and without removing the Import and Depends entries in the DESCRIPTION file?
After consulting --help, I tried the --no-test-load option but no luck.
I reckon you want to build a .zip binary version of the package on a computer where not all dependencies are installed. And I'm afraid I'll have to disappoint you, as this won't be possible.
Building a binary package is done in two steps: first the package is installed from source (that's why you have to use R CMD INSTALL and then the created binaries are zipped in a convenient format for installation on a windows machine. The dependencies are checked at time of installation from source, and any missing dependencies will throw the error you're facing.
As R needs information from the dependencies at time of installation from source, you can't get around installing them before building the whole thing. This also makes sense. An installed package in R contains a set of .rds files which contain package information in a more convenient format for R. In order to create that information for the NAMESPACE file, it needs to be able to access the packages from which functions are imported. If not, it can't construct the correct information about the namespace.
So your only option is to install the dependencies on the computer you use to build. And if you actually want to use the package on that computer, you'll have to install those dependencies anyway.
More information:
R Internals : https://cran.r-project.org/doc/manuals/r-release/R-ints.html#Package-Structure
Writing R Extensions: https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Package-namespaces

Possible to install a package without installing dependencies?

Is it possible to install a package without installing dependencies?
When run the following command:
install.packages("package",dependencies=FALSE)
if the dependencies are not installed beforehand, isn't it that the installation of the package fails?
My question comes from this post Install a local R package with dependencies from CRAN mirror. Why does it say installing a local package without installing dependencies?
if I set repos=NULL it correctly tries to install the local package
file (as documented), but obviously it does not find the dependencies
packages.
Thanks!
You cannot install and get a package to work without its dependencies. The dependencies= parameter is really an indicator if you would like R to automatically install the dependencies. If set to FALSE, R still stop and warn you so you can decide what you would like to do; if TRUE, R will automatically try to download from your current CRAN repository mirror. With repos=NULL (a local file install) there is nowhere else to look for dependencies so the dependencies= parameter is ignored.

Resources