forked from computationalstylistics/stylo
-
Notifications
You must be signed in to change notification settings - Fork 1
/
installstartstyAH.R
132 lines (121 loc) · 3.7 KB
/
installstartstyAH.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
options(repos = list(CRAN="http://cran.rstudio.com/"))
print("R Script to install/start stylo Ancient History Edition.")
thewd <- getwd()
theinstdir <- dirname(thewd)
print("Build directory for stylo AH:")
print( theinstdir )
setwd( theinstdir )
#IF OLD PACKAGES ARE INSTALLED, different R version;
#if (require( "tcltk2", character.only = TRUE)) {
# remove.packages("tcltk2")
#}
#if (require( "pamr", character.only = TRUE)) {
# remove.packages("pamr")
#}
#
#if (require( "e1071", character.only = TRUE)) {
# remove.packages("e1071")
#}
#if (require( "readr", character.only = TRUE)) {
# remove.packages("readr")
#}
#if (require( "tsne", character.only = TRUE)) {
# remove.packages("tsne")
#}
#if (require( "reticulate", character.only = TRUE)) {
# remove.packages("reticulate")
#}
#
#if (require( "ape", character.only = TRUE)) {
# remove.packages("ape")
#}
#
#if (require( "networkD3", character.only = TRUE)) {
# remove.packages("networkD3")
#}
#
#if (require( "parallel", character.only = TRUE)) {
# remove.packages("parallel")
#}
#
#if (require( "transport", character.only = TRUE)) {
# remove.packages("transport")
#}
#
#if (require( "statip", character.only = TRUE)) {
# remove.packages("statip")
#}
#remove.packages( "rappdirs" )
#remove.packages( "askpass" )
#remove.packages( "lazyeval" )
#remove.packages( "purrr" )
#remove.packages( "stylo" )
#remove.packages( "styloAH" )
#remove.packages( "tidyselect" )
#update all other packages - R version
#update.packages( checkBuilt=TRUE, ask=FALSE, repos="http://r-forge.r-project.org" )
#DEPENDENCIES
print("Check for / install dependancies:")
if (!require( "lazyeval", character.only = TRUE)) {
install.packages("lazyeval", dependencies = TRUE)
}
if (!require( "rappdirs", character.only = TRUE)) {
install.packages("rappdirs", dependencies = TRUE)
}
if (!require( "tcltk2", character.only = TRUE)) {
install.packages("tcltk2", dependencies = TRUE)
}
if (!require( "pamr", character.only = TRUE)) {
install.packages("pamr", dependencies = TRUE)
}
if (!require( "e1071", character.only = TRUE)) {
install.packages("e1071", dependencies = TRUE)
}
if (!require( "readr", character.only = TRUE)) {
install.packages("readr", dependencies = TRUE)
}
if (!require( "tsne", character.only = TRUE)) {
install.packages("tsne", dependencies = TRUE)
}
if (!require( "reticulate", character.only = TRUE)) {
install.packages("reticulate", dependencies = TRUE)
}
if (!require( "ape", character.only = TRUE)) {
install.packages("ape", dependencies = TRUE)
}
if (!require( "networkD3", character.only = TRUE)) {
install.packages("networkD3", dependencies = TRUE)
}
if (!require( "parallel", character.only = TRUE)) {
install.packages("parallel", dependencies = TRUE)
}
if (!require( "transport", character.only = TRUE)) {
install.packages("transport", dependencies = TRUE)
}
if (!require( "statip", character.only = TRUE)) {
install.packages("statip", dependencies = TRUE)
}
#check which packages are installed
#installed.packages()
print("Build and install stylo AH:")
#file.rename("energy-master", "energy")
#system("R CMD build energy")
#install.packages("energy_1.7-8.tar.gz", repos = NULL)
file.rename("styloAH-master", "styloAH") #just in case
system("R CMD build styloAH") #build downloaded version
install.packages("styloAH_0.7.4.9.tar.gz", repos = NULL)
print("Working directory for stylo AH:")
newwd <- paste( theinstdir, "/styloAH", sep="")
print( newwd )
setwd( newwd )
print("Libraries / source python libraries:")
library(reticulate)
source_python("textnorm.py")
source_python("textdecomp.py")
library(tcltk2)
library(parallel)
library(transport)
library(statip)
library(styloAH)
print("Run stylo:")
stylo()