Events News Research CBS CBS Publications Bioinformatics
Staff Contact About Internal CBS CBS Other

R packages


Packages under R are bundles of functions and/or data that typically enables a special kind of analysis, visualization, handing of data, or functionality to the R session. Some basic packages are loaded by default, others you must load your self. Packages may be loaded using the library() or require() commands.

Example:
library(genefilter)

Each loaded package is contained in a separate workspace and a list of the workspaces can be generated using the search() command.
search()
 [1] ".GlobalEnv"         "package:genefilter" "package:stats" 
 [4] "package:graphics"   "package:grDevices"  "package:utils"  
 [7] "package:datasets"   "package:pll"        "package:multicore" 
[10] "package:methods"    "Autoloads"          "package:base"

The content of a workspace can be listed using the ls() command.
This example, lists the second workspace ("package:genefilter"):

ls(2)
 [1] "AUC"             "Anova"           "allNA"           "anyNA"         
 [5] "area"            "colFtests"       "colttests"       "coxfilter"   
 [9] "cv"              "dist2"           "eSetFilter"      "fastT"       
[13] "featureFilter"   "filter_volcano"  "filtered_R"      "filtered_p"   
[17] "filterfun"       "findLargest"     "gapFilter"       "genefilter"   
[21] "genefinder"      "genescale"       "getFilterNames"  "getFuncDesc"  
[25] "getRdAsText"     "half.range.mode" "isESet"          "kOverA"       
[29] "kappa_p"         "kappa_t"         "maxA"            "nsFilter"      
[33] "pAUC"            "pOverA"          "parseArgs"       "parseDesc"     
[37] "plot"            "rejection_plot"  "rowFtests"       "rowSds"        
[41] "rowVars"         "rowpAUCs"        "rowttests"       "sens"          
[45] "setESetArgs"     "shorth"          "showESet"        "spec"          
[49] "tdata"           "ttest"           "varFilter" 
Please, note that the first workspace is always ".GlobalEnv", which contains the variables that you have generated yourself.

Installing packages


R comes with a set of default packages, but you may need additional packages. Such packages must be downloaded and installed on your system, before you can load them. Many additional, packages can be found at the cran or Bioconductor repository. You may search for packages using Rseek.

R on both Windows and Mac have menu based functions for downloading and installing packages, in their GUIs. In these you should first select repository and then install the package. Under Mac you can choose to also install packages that your package is depending on, by selecting install dependencies - do that.

However, sometimes these are cumbersome or fail to get the packages and their dependencies installed properly. Alternatively you may install packages from Bioconductor using these commands:
source("http://bioconductor.org/biocLite.R")
biocLite("genefilter") # here installing the package genfilter
Or from cran
install.packages("hexbin") # here installing the package hexbin
In both cases they have to be loaded after the installation
require(hexbin)