Search code examples
rshared-librariesstandards

Is there such a thing as a standard library in R?


Almost every major programming language comes with a standard library. It seems that R doesn't. There is a huge number of custom packages at CRAN, but I couldn't find something that qualifies as "standard library". The base package seems to come close, but then there is also the recommended package and I couldn't find consensus which one come closest to what one would call "standard library".


Solution

  • Bill Dunlap shared code for how to identify all of the packages that come with the standard distribution of your version of R.

    i <- installed.packages() 
    i[ i[,"Priority"] %in% c("base","recommended"), c("Package", "Priority")] 
    

    The "recommended" packages are shipped with R, but not loaded when R starts.

    Edited to include a comment from joran: "Those packages are recommended, and will be in binary installations, but maybe not source installations of R."

    Ref: http://r.789695.n4.nabble.com/List-of-default-packages-that-come-with-R-td4661857.html

    Result for R 3.4.1

               Package      Priority     
    base       "base"       "base"       
    boot       "boot"       "recommended"
    class      "class"      "recommended"
    cluster    "cluster"    "recommended"
    codetools  "codetools"  "recommended"
    compiler   "compiler"   "base"       
    datasets   "datasets"   "base"       
    foreign    "foreign"    "recommended"
    graphics   "graphics"   "base"       
    grDevices  "grDevices"  "base"       
    grid       "grid"       "base"       
    KernSmooth "KernSmooth" "recommended"
    lattice    "lattice"    "recommended"
    MASS       "MASS"       "recommended"
    Matrix     "Matrix"     "recommended"
    methods    "methods"    "base"       
    mgcv       "mgcv"       "recommended"
    nlme       "nlme"       "recommended"
    nnet       "nnet"       "recommended"
    parallel   "parallel"   "base"       
    rpart      "rpart"      "recommended"
    spatial    "spatial"    "recommended"
    splines    "splines"    "base"       
    stats      "stats"      "base"       
    stats4     "stats4"     "base"       
    survival   "survival"   "recommended"
    tcltk      "tcltk"      "base"       
    tools      "tools"      "base"       
    utils      "utils"      "base"