How to use R CMD installation without dependency checking?

I run R CMD INSTALL --build package on a Windows computer. My package imports several other packages, which themselves depend on some packages. I have all the dependencies installed in the local r_libs folder and everything works.

Now sometimes I have the source code of my package on another Windows computer. I do not have all the dependency packages installed on this computer.

When I try to use the 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 create a package using R CMD INSTALL --build without dependency checks and without deleting the Import and Depends entries in the DESCRIPTION file?

After consulting with --help I tried the --no-test-load option, but no luck.

+5
source share
1 answer

I believe that you want to create a binary version of the .zip package on a computer where not all dependencies are installed. And I'm afraid that I will have to disappoint you, because it will be impossible.

Creating a binary package is carried out in two stages: first, the package is installed from the source code (therefore, you need to use R CMD INSTALL , and then the created binaries are sewn in a convenient format for installation on a Windows machine. They are checked during installation from the source, and any missing dependencies will be cause the error you are facing.

Since R needs information from dependencies during installation from the source, you cannot get around installing them before building all of this. It also makes sense. An installed package in R contains a set of .rds files that contain package information in a more convenient format for R. To create this information for a NAMESPACE file, it must have access to packages from which functions are imported. If not, it cannot create the correct namespace information.

Thus, your only option is to install the dependencies on the computer that you use to build. And if you really want to use the package on this computer, you still have to install these dependencies.

Additional 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

+3
source

Source: https://habr.com/ru/post/1243381/


All Articles