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
You can manually specify what you’d like to have installed, for example:
R CMD INSTALL [options] <package-name>
or withinstall.packages("package-name", INSTALL_opts = c("--option1", "--option2"))
where relevant options for your case might be the following:Alternatively you could use
install2.r
from thelittler
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
anddocopt
packages in combination withinstall2.r
. Besides the options that are provided, you can also includeR CMD INSTALL
arguments. The process is described hereIf 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 installggplot2
without HTML help. You can specify an individual installation process for each desired package whereas dependencies are set toNA
by default.