Togaware DATA MINING
Desktop Survival Guide
by Graham Williams
Google


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="http://cran.us.r-project.org/")
> install.packages("ellipse") 	  # Installs the ellipse package from CRAN. 
> install.packages("H:/ellipse_2.0-14.zip", 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.

If we so chose, we could install all available packages using the new.packages() function which lists all packages that are available on CRAN but not installed:



> install.packages(new.pachages(), lib = .libPaths()[1])

This will take a very long time.

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
  http://cran.au.r-project.org/src/contrib        89           494

On a Debian or Ubuntu system the system supplied packages are installed into /usr/lib/R/library if they are part of the recommended suite of packages for R, and in /usr/lib/R/site-library if they are not part of the recommended suite. Packages installed in addition to those system supplied packages should go into /usr/local/lib/R/site-library.

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
$ok
 [1] "ISwR"       "ROCR"       "XML"        "ash"        "dprep"
 [6] "kernlab"    "leaps"      "modeltools" "mvpart"     "oz"
[11] "sfsmisc"    "vioplot"

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

\$unavailable
NULL


*** Library /usr/lib/R/site-library
$ok
 [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"

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

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


*** Library /usr/lib/R/library
$ok
 [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"

$upgrade
[1] "StatDataML" "nlme"

$unavailable
NULL



Available packages:
-------------------
(each package appears only once)

*** Repository http://cran.au.r-project.org/src/contrib
$installed
 [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 © Togaware Pty Ltd
Support further development through the purchase of the PDF version of the book.
The PDF version is a formatted comprehensive draft book (with over 800 pages).
Brought to you by Togaware. This page generated: Sunday, 22 August 2010