-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathinstallifnot.R
31 lines (29 loc) · 1014 Bytes
/
installifnot.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
installBiocifnot <- function(pckgName){
if (!(require(pckgName, character.only = TRUE))) {
source("http://Bioconductor.org/biocLite.R")
biocLite(pckgName)
require(pckgName, character.only = TRUE)
}
}
# Example
# installBiocifnot("CMA")
installifnot <- function(pckgName){
if (!(require(pckgName, character.only = TRUE))) {
install.packages(pckgName, dep = TRUE)
require(pckgName, character.only = TRUE)
}
}
# Example
# installifnot("xlsx")
installGitifnot <- function(pathGit, pckgName, proxy = FALSE, urlproxy = "conf_www.ir.vhebron.net", portproxy = 8081, force.install = FALSE){
if (!(require(pckgName, character.only = TRUE)) | force.install) {
require("devtools")
require("httr")
# require(curl)
if (proxy) set_config(use_proxy(url = urlproxy, port = portproxy))
install_github(file.path(pathGit,pckgName), force = force.install)
require(pckgName, character.only = TRUE)
}
}
# Example
# installGitifnot("miriammota","mmotaF",force.install = TRUE)