Search code examples
rdockerdockerfileinstall.packages

Is there an option to install R packages without documentation for more efficient storing?


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?


Solution

  • 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