Refer to the install.packages help file in R or execute R CMD INSTALL -help at the shell command line for a full list of command line options. $ R CMD INSTALL arules_1. -library=/home/username/Rpackages R> install.packages("arules", lib="/home/username/Rpackages") For example, to create an R package repository in your home directory: You can accept the personal library path chosen by R, or specify the library location by passing parameters to the install.packages function. If you don't run R as root, you won't have permission to write packages into the default system-wide location and you will be prompted to create a personal library accessible by your userid. If dependencies are not identified and installed prior to the package's installation, you will see an error similar to:ĮRROR: dependency 'xxx' is not available for package 'yyy'Īs a best practice and to save time, always refer to the package's CRAN site to understand the package dependencies prior to attempting an installation. Package dependencies are listed in the Depends section of the package's CRAN site. Then, install the package using the command R CMD INSTALL:Ī major difference between installing R packages using the R package installer at the R command line and shell command line is that package dependencies must be resolved manually at the shell command line.
To install packages this way, first locate the package on CRAN and then download the package source to your local machine. This is useful for some packages when an internet connection is not available or for installing packages not uploaded to CRAN. You can also install R from the shell command line. This is a huge benefit that frees users from the task of identifying and resolving those dependencies. If the arules package depends upon other packages that are not already installed locally, the R installer automatically downloads and installs those required packages. Within R, using the install.packages function always attempts to install the latest version of the requested package available on CRAN: It installs the arules package as root so that packages are installed in the default R system-wide location where all users can access it, /usr/lib64/R/library. The following example installs a package on Oracle Linux using Oracle R Distribution. R package installation basics are outlined in Chapter 6 of the R Installation and Administration Guide. You can install R packages from the R command line or from your system’s command line.