-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMarkovHC-install.R
43 lines (39 loc) · 2.32 KB
/
MarkovHC-install.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
32
33
34
35
36
37
38
39
40
41
42
43
# Install requirements: parallel, doParallel, dbscan, igraph, Matrix, Rcpp, plyr, dplyr, doBy, ggraph
# Require R version >= 3.5
if (as.numeric(R.version$major) <= 3 && as.numeric(R.version$minor) < 5) {
# R < 3.5
message("Require R version >= 3.5")
} else {
# R >= 3.5
message("Installing required packages from cran.")
install.packages(c("parallel", "doParallel", "dbscan", "igraph", "Matrix", "Rcpp", "plyr", "dplyr", "doBy", "ggraph"))
}
# Check that packages installation went smoothly.
if (!requireNamespace("parallel", quietly = TRUE)) {stop("Failed to install required package 'parallel' from cran.")}
if (!requireNamespace("doParallel", quietly = TRUE)) {stop("Failed to install required package 'doParallel' from cran.")}
if (!requireNamespace("dbscan", quietly = TRUE)) {stop("Failed to install required package 'dbscan' from cran.")}
if (!requireNamespace("igraph", quietly = TRUE)) {stop("Failed to install required package 'igraph' from cran.")}
if (!requireNamespace("Matrix", quietly = TRUE)) {stop("Failed to install required package 'Matrix' from cran.")}
if (!requireNamespace("Rcpp", quietly = TRUE)) {stop("Failed to install required package 'Rcpp' from cran.")}
if (!requireNamespace("plyr", quietly = TRUE)) {stop("Failed to install required package 'plyr' from cran.")}
if (!requireNamespace("dplyr", quietly = TRUE)) {stop("Failed to install required package 'dplyr' from cran.")}
if (!requireNamespace("doBy", quietly = TRUE)) {stop("Failed to install required package 'doBy' from cran.")}
if (!requireNamespace("ggraph", quietly = TRUE)) {stop("Failed to install required package 'ggraph' from cran.")}
# Install MarkovHC (and devtools, if necessary)
if (requireNamespace("devtools", quietly = TRUE)) {
message("Installing MarkovHC")
devtools::install_github(repo="ZhenyiWangTHU/MarkovHC",subdir = "/MarkovHC")
} else {
message("Installing devtools")
install.packages("devtools")
message("Installing MarkovHC")
devtools::install_github(repo="ZhenyiWangTHU/MarkovHC",subdir = "/MarkovHC")
}
# Check that MarkovHC installed.
if (requireNamespace("MarkovHC", quietly = TRUE)) {
message("MarkovHC installed successfully!")
message('You can load it by typing: library("MarkovHC")')
message('Try "?MarkovHC" for starting tips.')
} else {
message("Something went wrong. It doesn't seem that MarkovHC installed correctly.")
}