skip to Main Content

I am installing packages based on a Docker file in a machine with very small storage capacities.
My question is whether there is any way to install a more lightweight version of R packages that avoids non-critical bits of the package for deployed code such as the documentation.
Is there a way to do this through install.packages?
Otherwise, is there any other way to do it?

2

Answers


  1. You can manually specify what you’d like to have installed, for example:
    R CMD INSTALL [options] <package-name> or with install.packages("package-name", INSTALL_opts = c("--option1", "--option2")) where relevant options for your case might be the following:

          --no-docs     do not install HTML, LaTeX or examples help
          --no-html     do not build HTML help
          --no-R, --no-libs, --no-data, --no-help, --no-demo, --no-exec,
          --no-inst
                suppress installation of the specified part of the
                package for testing or other special purposes
          --libs-only   only install the libs directory
          --data-compress=  none, gzip (default), bzip2 or xz compression
                to be used for lazy-loading of data
          --resave-data re-save data files as compactly as possible
          --compact-docs    re-compress PDF files under inst/doc
    
    Login or Signup to reply.
  2. Alternatively you could use install2.r from the littler package as described here as a simple way to ensure that building is quitted if an error occurrs or to select whether you’d like to include dependencies.

    Regarding a lightweight installation, and corresponding to the suggestion by Mat D., you could use littler and docopt packages in combination with install2.r. Besides the options that are provided, you can also include
    R CMD INSTALL arguments. The process is described here

    If the library location (libloc) is set, you can use docopt to specify the desired installation details.

    For instance, install2.r -n 4 ggplot2 --no-html will allow parallel installation using 4 processes and install ggplot2 without HTML help. You can specify an individual installation process for each desired package whereas dependencies are set to NA by default.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search