[R] How can I check a package is installed or not?

Fabrice Tourre fabrice.ciup at gmail.com
Tue Sep 27 21:19:10 CEST 2011


Dear list,

How can I detect a package is installed or not? If not, then install it.

For example, in a script, I want to check the package DESeq is
installed or not. If not, then I will using this script to install it.

source("http://www.bioconductor.org/biocLite.R")
biocLite("DESeq")

The pseudo script would be like this:

try:
    library("DESeq")
catch:
    source("http://www.bioconductor.org/biocLite.R")
    biocLite("DESeq")

Thank you



More information about the R-help mailing list