-
Notifications
You must be signed in to change notification settings - Fork 0
/
INSTALL.sh
57 lines (49 loc) · 1.57 KB
/
INSTALL.sh
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
44
45
46
47
48
49
50
51
52
53
54
55
#
# Install script for the SOM_DIR repository
# Written by A.H. Wright (2018-10-22)
#
#Attempt to get the paths of R & Rscript from $PATH
R=`which R`
Rscript=`which Rscript`
#If R doesn't exist, it should be installed
if [ "$R" == "" ];
then
echo "R must be manually installed on your machine & placed in your \$PATH"
exit 1
fi
#If Rscript doesn't exist, it should be installed
if [ "$Rscript" == "" ];
then
echo "Rscript must be manually installed on your machine & placed in your \$PATH"
echo "NB: You appear to have R, so Rscript is probably just missing from your \$PATH"
exit 1
fi
#Check that the relevant R libraries are installed
$R --no-save --slave <<EOF
#Function to quickly check for and install libraries
require.and.load<-function(name,githubrep) {
if (!missing(githubrep)) {
remotes::install_github(paste(githubrep,name,sep='/'),upgrade='always')
if (grepl('/',name)) {
name<-rev(strsplit(name,'/')[[1]])[1]
}
} else {
install.packages(name,repos='https://cloud.r-project.org/')
}
if (!require(name,character.only=TRUE)) {
stop(paste("Failed to install package",name))
}
}
#Look for and install the important packages for the script
require.and.load('remotes')
require.and.load('RColorBrewer')
require.and.load('kohonen')
require.and.load('KernSmooth')
require.and.load('itertools')
require.and.load('matrixStats')
require.and.load('data.table')
require.and.load('helpRfuncs','AngusWright')
require.and.load('FITSio')
#require.and.load('LAMBDAR','AngusWright')
require.and.load('kohonen/kohonen','AngusWright')
EOF