source("http://bioconductor.org/biocLite.R") major <- as.numeric(R.Version()$major) minor <- as.numeric(R.Version()$minor) if (major == 2 && (minor >= 12 && minor < 13)) { ##ok } else { stop("You must be running R version 2.12") } courseRepos <- "http://bioconductor.org/course-packages" allRepos <- c(courseRepos, biocinstallRepos()) courseInstall <- function (package) { install.packages(package, repos = allRepos) } install.snapshot <- function(version, package="StudentGWAS") { try(detach(paste("package:",package, sep=""),force=TRUE), silent=TRUE) try(remove.packages(package),silent=TRUE) tempdir <- tempdir() contribUrl <- contrib.url("http://bioconductor.org/course-packages") ext <- ".zip" if (.Platform$pkgType == "source") { ext <- ".tar.gz" } else if (.Platform$pkgType == "mac.binary.leopard") { ext <- ".tgz" } else if (.Platform.pkgType == "win.binary") { ext <- ".zip" } pkgUrl <- paste(contribUrl, "/", package, "_", version, ext, sep="") destFile <- paste(tempdir, "/", package, "_", version, ext, sep="") download.file(pkgUrl, destFile) install.packages(destFile, repos=NULL) unlink(destFile) print(paste("Installed ",package, ", version ", version, ".", sep="")) invisible(NULL) }