-
Notifications
You must be signed in to change notification settings - Fork 2
/
testing.R
executable file
·63 lines (41 loc) · 1.3 KB
/
testing.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
devtools::install("./misc/R/MOrepoTools/")
devtools::install_local("./misc/R/MOrepoTools/", force = T)
detach(package:MOrepoTools)
library(MOrepoTools)
MOrepoTools:::setMetaContributions()
for(i in 1:10){
try({
MOrepoTools:::setMetaInstances()
break
}, silent = FALSE)
}
for(i in 1:10){
try({
r <- MOrepoTools:::setMetaResults()
break
}, silent = FALSE)
}
## rename/move files
a <- list.files(path = "./instances/", pattern = "*$_*$", recursive = T, full.names = T)
b <- basename(a)
b <- sub("biap","",b)
b <- sub("_0","",b)
b <- sub(".xml","",b)
b<-paste0("./instances/xml/Tuyttens_AP_n",b,".xml")
file.rename(a,b)
## add 0 to file names
a <- list.files(path = "./raw", pattern = "*._p[:digit:]*._..raw", recursive = T, full.names = T)
b<-sapply(a, FUN=function(x) {
m <- regexpr("p.", x)
y <- regmatches(x, m)
y <- paste0("p", sprintf("%02d", as.numeric(substr(y,2,2))))
sub('p.', y, x)
})
file.rename(a,b)
## rename/move files
a <- list.files(path = "results", pattern = ".*Pedersen08_.*_._result.json$", recursive = T, full.names = T)
b <- sub("(*)_(.)_(result*..json)$","\\1_0\\2_\\3",a)
file.rename(a,b)
a <- list.files(path = "results", pattern = "non", recursive = T, full.names = T)
b <- sub("(.*)/(.*.json)$","\\1/Pedersen08_\\2",a)
file.rename(a,b)