DATA MINING
Desktop Survival Guide by Graham Williams |
|||||
Testing Package Availability |
If a function you write depends on the functionality of some package,
such as gplots, use the stopifnot function
to exit if the package is not available:
myfun <- function() { stopifnot(require(gplots)) [...] } |
Also, the .packages can be used to list all packages
that have been installed on your system:
> .packages(all=TRUE) [1] "acepack" "ada" "amap" [4] "arules" "bitops" "butler" [..] [73] "tcltk" "tools" "utils" [76] "mapdata" |
And a call to the library function with no arguments
will list all packages installed, and a one line description:
> library() Packages in library '/usr/lib/R/library': base The R Base Package datasets The R Datasets Package graphics The R Graphics Package [...] Packages in library '/usr/local/lib/R/site-library': acepack ace() and avas() for selecting regression transformations ada Performs boosting algorithms for a binary response [...] XML Tools for parsing and generating XML within R and S-Plus. xtable Export tables to LaTeX or HTML |