-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathmain.R
More file actions
118 lines (94 loc) · 3.47 KB
/
main.R
File metadata and controls
118 lines (94 loc) · 3.47 KB
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
#helper functions for calculating and plotting CIs
source('plot_CIs.R')
source('plot_CIs_both_datatypes.R')
source('bootCIs.R')
#load data
datatype <- "temperature"
print(paste("processing ",datatype," datatype",sep=""))
source('processLogCSVs.R', encoding = 'UTF-8')
#RT CIs
source('RT_CIs_r.R') #by representation
source('RT_CIs_g.R') #by granularity
source('RT_CIs_t.R') #by target (start / end / range)
#err CIs
source('err_CIs_r.R') #by representation
source('err_CIs_g.R') #by granularity
source('err_CIs_t.R') #by target (start / end / range)
#confidence
source('confidence_CIs.R') #confidence by representation x granularity
#preference
source('preference_CIs.R') #confidence by representation x granularity
#export plots
source('plot_export.R') #confidence by representation x granularity
# get the names of the variables in the global environment
globalVariables <- ls(envir=.GlobalEnv)
for(.name in globalVariables){
x <- get(.name,envir=.GlobalEnv)
if(inherits(x,'data.frame')){
newName <- paste(datatype,"_",.name,sep = "")
# bind the value x to the new name in the global environment
assign(newName,x,envir=.GlobalEnv)
# delete the binding to the old name in the global environment
rm(list=.name,envir=.GlobalEnv)
}
else if(inherits(x,'gg')){
newName <- paste(datatype,"_",.name,sep = "")
# bind the value x to the new name in the global environment
assign(newName,x,envir=.GlobalEnv)
# delete the binding to the old name in the global environment
rm(list=.name,envir=.GlobalEnv)
}
else {
print(.name)
}
}
newName <- paste(datatype,"_excluded_participants",sep = "")
assign(newName,excluded_participants,envir=.GlobalEnv)
rm(excluded_participants)
#repeat for second datatype
first_datatype <- datatype
datatype <- "sleep"
print(paste("processing ",datatype," datatype",sep=""))
source('processLogCSVs.R', encoding = 'UTF-8')
#RT CIs
source('RT_CIs_r.R') #by representation
source('RT_CIs_g.R') #by granularity
source('RT_CIs_t.R') #by target (start / end / range)
#err CIs
source('err_CIs_r.R') #by representation
source('err_CIs_g.R') #by granularity
source('err_CIs_t.R') #by target (start / end / range)
#confidence
source('confidence_CIs.R') #confidence by representation x granularity
#preference
source('preference_CIs.R') #confidence by representation x granularity
#export plots
source('plot_export.R') #confidence by representation x granularity
# get the names of the variables in the global environment
remove(x)
globalVariables <- ls(envir=.GlobalEnv)
globalVariables <- globalVariables[!(grepl(first_datatype,globalVariables))]
for(.name in globalVariables){
x <- get(.name,envir=.GlobalEnv)
if(inherits(x,'data.frame')){
newName <- paste(datatype,"_",.name,sep = "")
# bind the value x to the new name in the global environment
assign(newName,x,envir=.GlobalEnv)
# delete the binding to the old name in the global environment
rm(list=.name,envir=.GlobalEnv)
}
else if(inherits(x,'gg')){
newName <- paste(datatype,"_",.name,sep = "")
# bind the value x to the new name in the global environment
assign(newName,x,envir=.GlobalEnv)
# delete the binding to the old name in the global environment
rm(list=.name,envir=.GlobalEnv)
}
else {
print(.name)
}
}
newName <- paste(datatype,"_excluded_participants",sep = "")
assign(newName,excluded_participants,envir=.GlobalEnv)
rm(excluded_participants)
source('plot_export_both_datatypes.R') #confidence by representation x granularity