############################################################################### # installPackages() # # Usage: # source("http://www.braju.com/R/hbLite.R") # installPackages("http://www.braju.com/R/repos/R.oo_1.4.3.zip") # # Author: Henrik Bengtsson, http://www.braju.com/R/ ############################################################################### installPackages <- function(pkgs, repos=getOption("repos"), ..., destPath=".", cleanup=TRUE) { # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Local functions # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - isUrl <- function(url, ...) { url <- tolower(url); (regexpr("^(http|ftp)://", url) != -1); } for (kk in seq(along=pkgs)) { pkg <- pkgs[kk]; if (isUrl(pkg)) { url <- pkg; filename <- basename(url); pathname <- file.path(destPath, filename); if (!file.exists(pathname)) download.file(url, destfile=pathname, mode="wb"); if (!file.exists(pathname)) throw("Failed to download package file: ", url); install.packages(pathname, repos=NULL, ...); if (cleanup) { file.remove(pathname); if (file.exists(pathname)) throw("Failed to remove package file after installation: ", pathname); } } else { install.packages(pkg, repos=repos, ...); } } } # installPackages() hbInstallPackages2 <- function(pkgs, ..., verbose=FALSE) { # Contribution URLs url <- list( braju = "http://www.braju.com/R/repos", cran = NULL, # DEFAULT bioc = NULL # DEFAULT ) for (kk in seq(along=pkgs)) { pkg <- pkgs[kk]; cat("Installing/updating: ", pkg, "\n", sep=""); # Extract the repositories pattern <- "^(.*):(.*)"; if (regexpr(pattern, pkg) != -1) { repos <- gsub(pattern, "\\1", pkg); repos <- strsplit(repos, split=",", fixed=TRUE)[[1]]; pkgName <- gsub(pattern, "\\2", pkg); } else { repos <- "BRAJU"; pkgName <- pkg; } # Extract optional tags parts <- strsplit(pkgName, split=",", fixed=TRUE)[[1]]; pkgName <- parts[1]; tags <- parts[-1]; if (verbose) { cat("Repositories: ", paste(repos, collapse=", "), "\n", sep=""); cat("Package: ", pkgName, "\n", sep=""); cat("Tags: ", tags, "\n", sep=""); } for (jj in seq(along=repos)) { if (repos[jj] == "CRAN") { res <- hbInstallPackages(pkgName, contriburl=url$cran, ..., verbose=verbose); } else if (repos[jj] == "BIOC") { res <- hbBiocLite(pkgName, contriburl=url$bioc, ..., verbose=verbose); } else if (repos[jj] == "BIOCdev") { res <- hbBiocLite(pkgName, contriburl=url$bioc, rver="2.10.0", ..., verbose=verbose); } else if (repos[jj] == "RFORGE") { res <- hbInstallPackages(pkgName, contriburl=contrib.url("http://R-Forge.R-project.org"), ..., verbose=verbose); } else if (repos[jj] == "BRAJU") { # Note, some package contain native code. We try to provide # binaries also for OSX, but since we cannot build them # ourselves, we might lag behind for these. If we do not # have it available, we will enforce building from source, # which might fail for some users. ## ## && any(tags == "mac=source")) { type <- getOption("pkgType"); isMacBinary <- (regexpr("^mac.binary", type) != -1); if (isMacBinary) { if (identical(type, "mac.binary") && any(tags == "mac=hasBinary")) { cat("Installation/update of package '", pkgName, "', if needed, is enforced to be from universal binary version on Macs.\n"); } else { cat("If installation/update of package '", pkgName, "' is needed, it is enforced to be from source. The most likely reason for this is that the repository does currently not contain a prebuild binary version for Mac (or for the type '", type, "' requested).\n", sep=""); type <- "source"; } } res <- hbInstallPackages(pkgName, contriburl=url$braju, type=type, ..., verbose=verbose); } else { stop("Unknown repository: ", repos[jj]); } ## cat("Result: ", res, "\n", sep=""); } # for (jj ...) } # for (kk ...) } # hbInstallPackages2() ############################################################################### # hbLite() # # Usage: # source("http://www.braju.com/R/hbLite.R") # hbLite() # # Install all packages are the packages they depend on: # hbLite(".*") # # Install the 'aroma' package and its required and suggested packages: # hbLite("aroma", suggests=TRUE) # # Re-install the 'aroma' package without re-installing required packages: # hbLite("aroma", force=TRUE) # # Install the CRAN version of 'R.oo': # hbLite("R.oo", CRAN=TRUE) # # Author: Henrik Bengtsson, http://www.braju.com/R/ ############################################################################### hbLite <- function(pkgs=".*", force=FALSE, depends=!force, suggests=FALSE, CRAN=FALSE, ..., debug=FALSE, verbose=FALSE) { # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Local functions # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - trim <- function(s) { gsub("[ \t]*$", "", gsub("^[ \t]*", "", s)); } installMissing <- function(pkgs, available=NULL, lib=.libPaths()[1], ...) { if (length(pkgs) == 0) return(); ## cat("Searching for locally installed packages..."); installed <- installed.packages(lib.loc=lib)[,c("Package","Version"),drop=FALSE]; ## cat("done\n"); if (is.null(available)) { #str(list(...)); available <- available.packages(...)[,c("Package","Version"),drop=FALSE]; } if (length(pkgs) > 0) { cat("Updating packages: ", paste(pkgs, collapse=", "), "\n", sep=""); # Install one by one, so package that fails to install # will not prevent other packages from being installed. nbrOfPackages <- length(pkgs); for (kk in seq(length=nbrOfPackages)) { pkg <- pkgs[kk]; cat(sprintf(" %02d/%02d. %s: ", kk, nbrOfPackages, pkg)); availIdx <- which(pkg == available[,"Package"]); if (length(availIdx) == 0) { cat("not available.\n"); next; } else if (length(availIdx) > 1) { stop("Internal error of hbLite(): More than one version of the same package is available in the repository.") } instIdx <- which(pkg == installed[,"Package"]); if (length(instIdx) > 0) { # In case more than one library is available, use the first # since that is the one loaded. if (length(instIdx) > 1) { instIdx <- instIdx[1]; } instVer <- installed[instIdx, "Version"]; availVer <- available[availIdx, "Version"]; tooOld <- (compareVersion(instVer, availVer) < 0); if (tooOld) { cat("v", instVer, ", but v", availVer, " is available, i.e. out of date. Updating:\n", sep=""); } else if (force) { cat("v", instVer, ", i.e. up to date, but forced installation requested. Installing:\n", sep=""); } else { cat("v", instVer, ", i.e. up to date.\n", sep=""); next; } } else { cat("missing. Installing:\n"); } tryCatch({ #str(list(pkg, lib=lib, ..., available=available)); install.packages(pkg, lib=lib, ..., available=available); }, error = function(ex) { tb <- capture.output(traceback()); msg <- paste("ERROR: Failed to install package: ", pkg, sep=""); cat(msg, "\n", sep=""); print(ex); if (debug) { cat("traceback():\n"); cat(tb, sep="\n"); cat("\nArguments:\n"); args <- list(pkg, lib=lib, ..., available=available); str(args); print(head(available)); print(tail(available)); } }) } } } # installMissing() # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # What dependancies are we interested in? # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - depFields <- c(); if (depends) depFields <- c(depFields, "Depends", "Imports"); if (suggests) depFields <- c(depFields, "Suggests"); # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Extract package information from repository # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # URL where the package repository is if (CRAN) { contriburl <- contrib.url(getOption("repos")); } else { ## contriburl <- "http://www.maths.lth.se/help/R"; contriburl <- "http://www.braju.com/R/repos"; } cat("Using repository: ", contriburl, "\n", sep=""); # Get available packages available <- available.packages(contriburl=contriburl); if (verbose) print(available[,c("Package", "Version"),drop=FALSE]); # Exclude bundles packages <- available[!is.na(available[,"Package"]),]; packages <- packages[,c("Package", "Version", depFields),drop=FALSE]; packages <- apply(packages, MARGIN=1, FUN=function(package) { as.list(package); }) # Clean up dependancies packages <- lapply(packages, FUN=function(package) { for (field in depFields) { value <- package[[field]]; if (length(value) == 0) next; value <- trim(unlist(strsplit(value, split=","))); excl <- (regexpr("^R ", value) != -1); value <- value[!excl]; # Remove version information, e.g. R (>= 2.4.0) value <- gsub(" [(].*$", "", value); package[[field]] <- value; } package; }) if (verbose) str(packages); # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Install all packages? # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if (identical(pkgs, ".*")) { pkgs <- names(packages); # Exclude some big packages from the default installation pkgs <- setdiff(pkgs, "aroma.affymetrix"); pkgs <- setdiff(pkgs, "aroma.core"); pkgs <- setdiff(pkgs, "aroma.cn"); # "Private" packages pkgs <- setdiff(pkgs, c("R.kelkoo")); } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Extract dependencies of all packages to be installed # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - lastToInstall <- NULL; toInstall <- pkgs; while (!identical(toInstall, lastToInstall)) { dependencies <- unlist(lapply(packages[toInstall], FUN=function(pkg) { tmp <- unlist(pkg[depFields]); if (!is.null(tmp)) tmp <- na.omit(tmp); tmp; })); dependencies <- unique(dependencies); lastToInstall <- toInstall; toInstall <- unique(c(dependencies, toInstall)); } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Now we have a list of package to be installed. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - cat("Identified packages to be processed:", paste(toInstall, collapse=", "), "\n"); # Packages of HB hbPackages <- intersect(toInstall, names(packages)); # Other packages, assume on CRAN cranPackages <- setdiff(toInstall, hbPackages); # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Finally, install # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # 1. Install all external packages if (length(cranPackages) > 0) { cat("Installing external packages...\n"); cat(" Packages: ", paste(cranPackages, collapse=", "), "\n"); installMissing(cranPackages, ...); cat("Installing external packages...done\n"); } # 2. Install package of HB if (length(hbPackages) > 0) { cat("Installing braju.com packages...\n"); cat(" Packages: ", paste(hbPackages, collapse=", "), "\n"); # Check if we're running on a Mac that requests packages in the Mac # binary format. Since we don't build such, enforce "source" instead. if (identical(getOption("pkgType"), "mac.binary")) { msg <- paste("Detected R option pkgType=\"mac.binary\" (or similar), which is not available. Enforcing installation from source instead for packages: ", paste(hbPackages, collapse=", "), sep=""); warning(msg); cat(msg, "\n", sep=""); # Enforce installing from "source". oopt <- options(pkgType="source"); # Reset any changes when done. on.exit(options(oopt), add=TRUE); } installMissing(hbPackages, available=available, contriburl=contriburl, ...); cat("Installing braju.com packages...done\n"); } } hbGet <- function(name, version=NULL, ext=c("tar.gz", "zip")) { # URL where the package repository is url <- "http://www.maths.lth.se/help/R"; url <- "http://www.braju.com/R/repos"; if (!is.null(version) && version %in% eval(formals(hbGet)$ext)) { ext <- version; version <- NULL; } if (is.null(version) || version == "latest") { # Load PACKAGES.gz file urlPath <- paste(url, "PACKAGES", sep="/"); # Search for both the unzipped and zipped file urlPaths <- paste(urlPath, c("", ".gz"), sep=""); tmpfile <- tempfile(); on.exit(file.remove(tmpfile)); found <- FALSE; for (urlPath in urlPaths) { tryCatch({ download.file(urlPath, destfile=tmpfile, mode="wb", cacheOK=FALSE); found <- TRUE; break; }, error = function(ex) {}) } if (!found) stop("Could not locate remote PACKAGE or PACKAGE.gz file"); packages <- readLines(gzfile(tmpfile)); # Extract all versions pattern <- "^Version:[ \t]*([^ \t]*).*$"; availVers <- gsub(pattern, "\\1", grep(pattern, packages, value=TRUE)); # Extract all packages pattern <- "^(Package|Bundle):[ \t]*([^ \t]*).*$"; availPkgs <- gsub(pattern, "\\2", grep(pattern, packages, value=TRUE)); names(availVers) <- availPkgs; version <- availVers[name]; if (is.na(version)) stop("Could not find latest version for package/bundle: ", name); } ext <- match.arg(ext); if (name == "R.classes") url <- file.path(url, name); file <- paste(name, "_", version, ".", ext, sep=""); url <- file.path(url, file); cat("Downloading '", url, "' to '", file.path(getwd(), file), "'...\n", sep=""); # Download download.file(url, file, mode="wb"); } # hbGet() # Add argument 'rver' to biocLite() biocLite <- function(..., rver=NULL) { # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Local functions # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - assignInBase <- function(name, value, ...) { env <- as.environment("package:base"); environment(value) <- env; unlockBinding(name, env); assignInNamespace(name, R.Version, ns="base", envir=env); assign(name, value, envir=env); lockBinding(name, env); } # assignInBase() # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Fake version of R during installation? # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if (!is.null(rver)) { v <- unlist(strsplit(rver, split="[.]")); # Fool biocLite() by modifying result of R.Version() and R.version. R.version.org <- base::R.version; R.Version.org <- base::R.Version; R.version <- base::R.version; R.version$major <- v[1]; R.version$minor <- paste(v[-1], collapse="."); R.version$version.string <- gsub("[12][.][0-9][.][0-9]", rver, R.version$version.string); assign("...R.version", R.version, env=globalenv()); R.Version <- function() get("...R.version", env=globalenv()); assignInBase("R.version", R.version); assignInBase("R.Version", R.Version); on.exit({ assignInBase("R.version", R.version.org); assignInBase("R.Version", R.Version.org); }); } tryCatch({ source("http://www.bioconductor.org/biocLite.R", local=TRUE); }, error = function(ex) { print(ex); }) biocLite(...); } # biocLite() ############################################################################### # hbInstallPackages() # # Description: # Installs packages unless an installed version already exists and # it is up to date. # # Usage: # source("http://www.braju.com/R/hbLite.R") # hbInstallPackages("aws") # # Author: Henrik Bengtsson, http://www.braju.com/R/ ############################################################################### hbInstallPackages <- function(pkgs, contriburl=NULL, type=getOption("pkgType"), available=NULL, lib=.libPaths()[1], ..., rver=NULL, force=FALSE, debug=FALSE, verbose=FALSE) { # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Local functions # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - assignInBase <- function(name, value, ...) { env <- as.environment("package:base"); environment(value) <- env; unlockBinding(name, env); assignInNamespace(name, R.Version, ns="base", envir=env); assign(name, value, envir=env); lockBinding(name, env); } # assignInBase() # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Validate arguments # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Argument 'pkgs': if (length(pkgs) == 0) return(); # Argument 'type': if (is.null(type)) type <- getOption("pkgType"); # Argument 'force': force <- as.logical(force); # Argument 'verbose': verbose <- as.logical(verbose); # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Fake version of R during installation? # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if (!is.null(rver)) { v <- unlist(strsplit(rver, split="[.]")); # Fool biocLite() by modifying result of R.Version() and R.version. R.version.org <- base::R.version; R.Version.org <- base::R.Version; R.version <- base::R.version; R.version$major <- v[1]; R.version$minor <- paste(v[-1], collapse="."); R.version$version.string <- gsub("[12][.][0-9][.][0-9]", rver, R.version$version.string); assign("...R.version", R.version, env=globalenv()); R.Version <- function() get("...R.version", env=globalenv()); assignInBase("R.version", R.version); assignInBase("R.Version", R.Version); on.exit({ assignInBase("R.version", R.version.org); assignInBase("R.Version", R.Version.org); }); } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Identify required version of packages # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - pattern <- "^([^ ]*).* \\(>= ([0-9.-]*)\\)"; vers <- gsub(pattern, "\\2", pkgs); vers[vers == pkgs] <- NA; pkgs <- gsub(pattern, "\\1", pkgs); ## if (verbose) cat("Searching for locally installed packages..."); installed <- installed.packages(lib.loc=lib)[,c("Package","Version"),drop=FALSE]; ## if (verbose) cat("done\n"); if (is.null(available)) { args <- list(...); args$contriburl <- contriburl; # This will be excluded if NULL. available <- do.call("available.packages", args=args); ## available <- available.packages(...); ## available <- available[,c("Package","Version"),drop=FALSE]; } siteStr <- contriburl; if (is.null(siteStr)) siteStr <- "DEFAULT"; if (verbose) cat("Updating packages: ", paste(pkgs, collapse=", "), " from repository '", siteStr, "'\n", sep=""); # Install one by one, so package that fails to install # will not prevent other packages from being installed. nbrOfPackages <- length(pkgs); for (kk in seq(length=nbrOfPackages)) { pkg <- pkgs[kk]; if (verbose) cat(sprintf(" %02d/%02d. %s: ", kk, nbrOfPackages, pkg)); availIdx <- which(pkg == available[,"Package"]); if (length(availIdx) == 0) { if (verbose) cat("not available.\n"); next; } else if (length(availIdx) > 1) { stop("Internal error of hbInstallPackages(): More than one version of the same package is available in the repository.") } instIdx <- which(pkg == installed[,"Package"]); if (length(instIdx) > 0) { # In case more than one library is available, use the first # since that is the one loaded. if (length(instIdx) > 1) { instIdx <- instIdx[1]; } instVer <- installed[instIdx, "Version"]; availVer <- available[availIdx, "Version"]; tooOld <- (compareVersion(instVer, availVer) < 0); if (tooOld) { if (verbose) cat("v", instVer, ", but v", availVer, " is available, i.e. out of date. Updating:\n", sep=""); } else if (force) { if (verbose) cat("v", instVer, ", i.e. up to date, but forced installation requested. Installing:\n", sep=""); } else { if (verbose) cat("v", instVer, ", i.e. up to date.\n", sep=""); next; } } else { if (verbose) cat("missing. Installing:\n"); } if (debug) { # print(head(available)); print(tail(available)); } tryCatch({ args <- list(pkgs=pkg, type=type, lib=lib, ..., available=available); args$contriburl <- contriburl; # This will be excluded if NULL. do.call("install.packages", args=args); }, error = function(ex) { tb <- capture.output(traceback()); msg <- paste("ERROR: Failed to install package: ", pkg, sep=""); cat(msg, "\n", sep=""); print(ex); # Debug output? if (debug) { cat("traceback():\n"); cat(tb, sep="\n"); cat("\nCall:\n"); str(args); print(head(available)); print(tail(available)); } }) } } # hbInstallPackages() hbBiocLite <- function(pkgs, ..., contriburl=NULL, verbose=FALSE) { hbNeedUpdate <- function(pkg, reqVersion=NA) { desc <- packageDescription(pkg); if (length(desc) == 1 && is.na(desc)) return(TRUE); if (is.na(reqVersion)) return(FALSE); (compareVersion(desc$Version, reqVersion) < 0); } # hbNeedUpdate() pattern <- "^([^ ]*).* \\(>= ([0-9.-]*)\\)"; names <- gsub(pattern, "\\1", pkgs); vers <- gsub(pattern, "\\2", pkgs); vers[vers == pkgs] <- NA; toInstall <- sapply(seq(along=pkgs), function(kk) { hbNeedUpdate(names[kk], vers[kk]) }); if (sum(!toInstall) > 0) { cat("Package up to date:", paste(pkgs[!toInstall], collapse=", "), "\n"); } if (sum(toInstall) == 0) return(); cat("Package to be installed:", paste(pkgs[toInstall], collapse=", "), "\n"); pkgs <- names[toInstall]; if (is.null(contriburl)) { biocLite(pkgs, ...); } else { hbInstallPackages(pkgs, ..., contriburl=contriburl, verbose=verbose); } } # hbBiocLite() ############################################################################### # hbInstall() # # Description: # Installs a package. # # Usage: # source("http://www.braju.com/R/hbLite.R") # hbInstall("aroma.affymetrix", repos="bioc2007") # hbInstall("aroma.affymetrix") # hbInstall("aroma.core") # # Author: Henrik Bengtsson, http://www.braju.com/R/ ############################################################################### hbInstall <- function(pkg, bioc=TRUE, ..., verbose=TRUE) { # Argument 'pkg': pkg <- as.character(pkg); # Argument 'bioc': bioc <- as.logical(bioc); # Argument 'verbose': verbose <- as.logical(verbose); if (identical(pkg, "aroma.affymetrix")) { pkgs <- c( "CRAN:digest (>= 0.4.2)", "CRAN:R.methodsS3 (>= 1.0.3)", "CRAN:R.oo (>= 1.6.5)", "CRAN:R.utils (>= 1.3.0)", "CRAN:R.cache (>= 0.2.0)", "CRAN:R.rsp (>= 0.3.6)", "CRAN:R.huge (>= 0.2.0)", "BIOC:affxparser (>= 1.16.0)", "CRAN:aroma.apd (>= 0.1.7)", "CRAN:R.filesets (>= 0.8.0)", "CRAN:matrixStats (>= 0.1.9)", "CRAN:RColorBrewer (>= 1.0-2)", "BIOC:aroma.light (>= 1.14.0)", "CRAN:aroma.core (>= 1.5.0)", "CRAN:aroma.affymetrix (>= 1.5.0)", "BIOC:DNAcopy (>= 1.20.0)", "BIOC:Biobase (>= 1.16.1)", "BIOC:preprocessCore (>= 1.8.0)", "BIOC:gcrma (>= 2.10.0)", "BIOC:affyio (>= 1.6.0)", "BIOC:affy (>= 1.24.0)", "CRAN:aws", "BIOC:GLAD (>= 1.12.0)", "RFORGE:sfit (>= 0.1.8)", "RFORGE:gsmoothr (>= 0.1.3)" ); } else if (identical(pkg, "aroma.cn")) { pkgs <- c( "CRAN:digest (>= 0.4.2)", "CRAN:R.methodsS3 (>= 1.0.3)", "CRAN:R.oo (>= 1.6.5)", "CRAN:R.utils (>= 1.3.0)", "CRAN:R.cache (>= 0.2.0)", "CRAN:R.rsp (>= 0.3.6)", "CRAN:R.filesets (>= 0.7.0)", "CRAN:matrixStats (>= 0.1.6)", "CRAN:princurve (>= 1.1.9)", "BIOC:aroma.light (>= 1.14.0)", "BIOC:affxparser (>= 1.16.0)", "CRAN:aroma.core (>= 1.4.0)", "BRAJU:aroma.cn (>= 0.4.4)" ); } else if (identical(pkg, "aroma.tcga")) { pkgs <- c( "CRAN:gsubfn (>= 0.5-0)", "CRAN:R.methodsS3 (>= 1.0.3)", "CRAN:R.oo (>= 1.6.5)", "CRAN:R.utils (>= 1.3.3)", "CRAN:R.cache (>= 0.2.0)", "CRAN:R.filesets (>= 0.8.0)", "CRAN:aroma.core (>= 1.5.0)" ); } else { stop("No install script available: ", pkg); } hbInstallPackages2(pkgs, ..., verbose=verbose); cat("------------------------------------------------------------\n"); cat("- Trying to install patches \n"); cat("------------------------------------------------------------\n"); if (require("aroma.core")) { downloadPackagePatch("aroma.core"); } if (require("aroma.affymetrix")) { downloadPackagePatch("aroma.affymetrix"); } cat("############################################################\n"); cat("# #\n"); cat("# Packages installed/updated. Please restart R. #\n"); cat("# #\n"); cat("############################################################\n"); } # hbInstall() ############################################################################### # HISTORY: # 2010-01-11 # o BUG FIX: Removed require("R.utils") from installPackages(), because it # would fail for fresh installations. # 2009-11-12 # o If an error occurs in hbInstallPackages(), a more explicit error message # is given. Some debug code is also given. # 2009-11-04 # o Update installation scripts. # 2009-09-04 # o Now aroma.core and aroma.affymetrix is installed from CRAN. # 2009-09-03 # o Now type="mac.binary.leopard" is also detected, but we don't provide # such binaries. # 2009-07-13 # o Now aroma.core is installed from braju.com. # 2009-06-29 # o Now hbInstall() install more packages from CRAN and BIOC (and fewer from # the local repository). # 2009-05-04 # o Now matrixStats() is installed from r-forge. # 2009-02-13 # o Added installation script for aroma.cn. # 2008-12-02 # o BUG FIX: Some download.file() were not explicitly set to mode="wb". # 2008-08-02 # o Made hbInstall() more generic and easier to read and update. # o Added hbInstallPackages2(). # 2008-05-22 # o Added installPackages(), which can install packages by their URLs. # 2008-05-04 # o BUG FIX: Now packages on braju are no longer installed as Mac binaries. # 2008-04-01 # o BUG FIX: If installing to an empty library, then 'Error in installed[, # "Package"] : incorrect number of dimensions' was thrown. Now drop=FALSE. # 2008-02-11 # o Added argument 'lib' to hbLite() and hbInstallPackages(). # 2007-12-10 # o Updated hbInstall("aroma.affymetrix") to install less packages. # 2007-12-03 # o Made 'sfit' part of the default aroma.affymetrix installation. # 2007-09-20 # o Added a note add the end of hbInstall() that R needs to be restarted. # 2007-08-29 # o BUG FIX: hbInstall() tried to install Mac binaries. It now reverts to # installation from "source" just like hbLite() does. # 2007-08-05 # o Added hbBiocLite(). # 2007-08-02 # o Now hbInstall() only install BioC package, if out of date. # 2007-08-01 # o Added hbInstall(). # o Created hbInstallPackages() from internal code of hbLite(). # 2007-07-01 # o Added argument 'verbose=FALSE'. # 2007-05-09 # o Updated biocLite(), because Bioconductor change the script so argument # 'rver' would not work anymore. Now base::R.version and base::R.Version() # is overridden while installing. # 2007-04-22 # o Updated biocLite(), because Bioconductor change the script so argument # 'rver' would not work anymore. Now the Bioconductor biocLite() version # is downloaded everytime this local biocLite() is called. # 2007-04-07 # o Now archived packages are back in the main directory. Easier to maintain. # 2007-02-13 # o Move all my packages to braju.com. # 2007-01-31 # o Now version information in dependencies are ignored. # 2007-01-17 # o Now argument 'rver' is added to biocLite(). biocLite2() remains for # backward compatibility for a while. # 2007-01-07 # o Added biocLite2(). # 2006-10-31 # o Now biocLite() is downloaded from the Bioconductor site too. # 2006-08-21 # o Now assuming PACKAGES.gz instead of PACKAGES. # 2006-08-06 # o Added '...' to hbLite() to pass arguments through to install.packages(). # 2006-05-30 # o BUG FIX: hbLite() did not identify dependencies correctly. # 2006-05-21 # o If a package was installed in more than one library, a internal R warning # was given. # 2006-04-21 # o When trying to install package in "mac.binary" format, packages are instead # installed in "source" format. # o Removed occational warnings on "is.na() applied to non-(list or vector)". # 2006-03-12 # o Now archived packages are in the subdirectory "archive/". # 2006-03-03 # o Totally rewritten: # - Now dependendent (and suggested) packages can be installed automatically. # 2006-02-21 # o Updated hbGet() so that if version=NULL, the latest version is downloaded. # o BUG FIX: hbGet() downloaded files as text and not as binary files. # 2005-11-03 # o Added hbGet(). # 2005-10-28 # o Created. ###############################################################################