Desktop Survival Guide
by Graham Williams

Package Management

Packages can be installed or updated using the install.packages function, which will connect to a CRAN repository on the Internet and download the package. If no repository has already been specified, R will request one to use. You can specify one using the options function. Your installed packages will be updated using the update.packages function, while packages can be removed using remove.packages.

> options(repos="")
> install.packages("ellipse") 	  # Installs the ellipse package from CRAN. 
> install.packages("H:/", repos=NULL)
> update.packages()
> remove.packages([...])

The available.packages function will list the packages available from the CRAN archives. See also installed.packages and download.packages.

You can identify the status of the packages you have installed in your R system with packageStatus. You will be asked to select a CRAN mirror from which to retrieve information about the available packages.

> packageStatus()
--- Please select a CRAN mirror for use in this session ---
Loading Tcl/Tk interface ... done
Number of installed packages:

                                ok upgrade unavailable
  /usr/local/lib/R/site-library 12      10           0
  /usr/lib/R/site-library       46      11          10
  /usr/lib/R/library            24       2           0

Number of available packages (each package/bundle counted only once):

                                           installed not installed        89           494

If you then request a summary of the packageStatus you will get details about the packages, including, for example, those available from each of the local libraries, identifying those that have upgrades available.

> summary(packageStatus())

Installed packages:

*** Library /usr/local/lib/R/site-library
 [1] "ISwR"       "ROCR"       "XML"        "ash"        "dprep"
 [6] "kernlab"    "leaps"      "modeltools" "mvpart"     "oz"
[11] "sfsmisc"    "vioplot"

 [1] "DAAG"         "arules"       "chplot"       "coin"         "ellipse"
 [6] "gbm"          "party"        "pixmap"       "plotrix"      "randomForest"


*** Library /usr/lib/R/site-library
 [1] "Design"     "Hmisc"      "MCMCpack"   "MNP"        "MatchIt"
 [6] "RMySQL"     "RODBC"      "RQuantLib"  "Rcmdr"      "Rmpi"
[11] "Zelig"      "abind"      "acepack"    "coda"       "date"
[16] "effects"    "fBasics"    "fCalendar"  "fExtremes"  "fMultivar"
[21] "fOptions"   "fPortfolio" "fSeries"    "gtkDevice"  "its"
[26] "lmtest"     "mapdata"    "mapproj"    "maps"       "misc3d"
[31] "multcomp"   "mvtnorm"    "pscl"       "psy"        "qtl"
[36] "quadprog"   "relimp"     "rgl"        "rpvm"       "rsprng"
[41] "sandwich"   "sm"         "snow"       "tkrplot"    "tseries"
[46] "zoo"

 [1] "DBI"               "Matrix"            "XML"
 [4] "car"               "gregmisc:gdata"    "gregmisc:gmodels"
 [7] "gregmisc:gplots"   "gregmisc:gregmisc" "gregmisc:gtools"
[10] "lme4"              "strucchange"

 [1] "RGtk"       "Rggobi"     "event"      "gnlm"       "growth"
 [6] "ordinal"    "repeated"   "reposTools" "rmutil"     "stable"

*** Library /usr/lib/R/library
 [1] "KernSmooth" "VR:MASS"    "VR:class"   "VR:nnet"    "VR:spatial"
 [6] "base"       "boot"       "cluster"    "datasets"   "foreign"
[11] "grDevices"  "graphics"   "grid"       "lattice"    "methods"
[16] "mgcv"       "rpart"      "splines"    "stats"      "stats4"
[21] "survival"   "tcltk"      "tools"      "utils"

[1] "StatDataML" "nlme"


Available packages:
(each package appears only once)

*** Repository
 [1] "DAAG"         "DBI"          "Design"       "Hmisc"        "ISwR"
 [6] "KernSmooth"   "MCMCpack"     "MNP"          "MatchIt"      "Matrix"
[11] "RMySQL"       "ROCR"         "RODBC"        "RQuantLib"    "Rcmdr"
[81] "sfsmisc"      "sm"           "snow"         "strucchange"  "survival"
[86] "tkrplot"      "tseries"      "vioplot"      "zoo"

$"not installed"
  [1] "AMORE"              "AlgDesign"          "AnalyzeFMRI"
  [4] "BHH2"               "BMA"                "BRugs"
  [7] "BSDA"               "Bhat"               "Biodem"
[487] "verification"       "verify"             "waveslim"
[490] "wavethresh"         "wle"                "xgobi"
[493] "xtable"             "zicounts"

Copyright © 2004-2006 [email protected]
Support further development through the purchase of the PDF version of the book.
Brought to you by Togaware.