29

Can anyone tell me what is the difference between base and recommended packages.

If there is link where base and recommended packages are mentioned please provide the links.

smci
  • 32,567
  • 20
  • 113
  • 146
jan5
  • 1,129
  • 3
  • 17
  • 28

4 Answers4

40

The difference actually comes from R Core and the way the R code is organised, for example in the upstream SVN repository.

In src/library/, you have all 'base' packages:

  • base
  • compiler
  • datasets
  • graphics
  • grDevices
  • grid
  • methods
  • parallel
  • splines
  • stats
  • stats4
  • tcltk
  • tools
  • translations
  • utils.

And none of these are on CRAN -- they only exist as part of 'base R'.

And you have a directory src/library/Recommended which by default is empty, but can be filled by using a helper script (tools/rsync-recommended) to get the list of Recommended packages off CRAN from a special (versioned) directory. For R version 3.3.3, it is CRAN/src/contrib/3.3.3/Recommended/ (with the CRAN part being your default mirror). It contains

  • KernSmooth
  • MASS
  • Matrix
  • boot
  • class
  • cluster
  • codetools
  • foreign
  • lattice
  • mgcv
  • nlme
  • nnet
  • rpart
  • spatial
  • survival

Edit 2016-09-06: Added utils to first set.

Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725
  • 9
    Implicit in this organization is that base packages are only updated with releases of R; there is a one-to-one relationship between versions of the base packages and versions of R. Recommended packages, since they are hosted on CRAN, can be and are updated between releases of R. – Brian Diggs Mar 14 '12 at 16:40
  • 1
    Correct. And because Recommended packages on CRAN may 'move ahead' of a given R version, the rsync script I mentioned synchronises with a *given set of Recommended packages picked for this R release* to minimize any surprises coming from, say, older R and newer CRAN. – Dirk Eddelbuettel Mar 14 '12 at 16:45
8

I'd like to answer from a slightly different perspective, and with functions rather than links. If Priority is "base", then the package is already installed and loaded, so all of its functions are available upon opening R. If Priority is "recommended", then the package was installed with base R, but not loaded. Before using the commands from this package, the user will have to load it with the library command, e.g. library(boot).

As to the links, installed.packages() with a filter for Priority should list all the packages that are installed and loaded (base) or just installed (recommended), so you don't really need any links.

x <- installed.packages()
x[ !is.na(x[ ,"Priority"]), c("Package", "Priority") ]

For all other packages, see available.packages(). See this link for details.

zx8754
  • 52,746
  • 12
  • 114
  • 209
andrekos
  • 2,822
  • 4
  • 27
  • 26
  • 1
    Not all base packages are loaded. Open a new R session, run `sessionInfo()`, and we will see that only `stats graphics grDevices utils datasets methods base` packages are attached. – zx8754 Nov 28 '17 at 11:48
  • 1
    Also, the weblink to `details` is broken. – zx8754 Nov 28 '17 at 12:10
5

I am guessing that you are talking about installing R on Linux.

This is documented in the installation instructions for (for example) Debian. You can find this at http://cran.csiro.au/bin/linux/debian/

Quoting from this page:

The r-recommended set of packages are:

   r-cran-boot
   r-cran-cluster
   r-cran-class
   r-cran-codetools
   r-cran-foreign
   r-cran-kernsmooth
   r-cran-lattice
   r-cran-mass
   r-cran-matrix
   r-cran-mgcv
   r-cran-nlme
   r-cran-nnet
   r-cran-rmatrix
   r-cran-rpart
   r-cran-spatial
   r-cran-survival
Andrie
  • 176,377
  • 47
  • 447
  • 496
4

This R command returns the names of all the base packages:

names(which(installed.packages()[ ,"Priority"] == "base", ))
# [1] "base"      "compiler"  "datasets"  "graphics"  "grDevices" "grid"     
# [7] "methods"   "parallel"  "splines"   "stats"     "stats4"    "tcltk"    
# [13] "tools"     "utils"    

And this R command returns the names of all the recommended packages:

names(which(available.packages(repos = c(CRAN = "https://cran.r-project.org"))[ ,"Priority"] == "recommended", ))
# [1] "boot"       "class"      "cluster"    "codetools"  "foreign"   
# [6] "KernSmooth" "lattice"    "MASS"       "Matrix"     "mgcv"      
# [11] "nlme"       "nnet"       "rpart"      "spatial"    "survival"  
ianmcook
  • 537
  • 4
  • 10