-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-df.R
More file actions
63 lines (50 loc) · 2.47 KB
/
build-df.R
File metadata and controls
63 lines (50 loc) · 2.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
load.data <- function(filename = "s.csv") {
data <- read.csv(filename, colClasses=c("integer", "character",
"character", "integer", "numeric"), quote="",
comment.char="")
data$method.type <-
sub("super_quickmergesort", "Merge.Quick.Sorted", data$method.type)
data$method.type <-
sub("insertionsort_w", "Insertion", data$method.type)
data$method.type <-
sub("quicksort_w", "Quicksort", data$method.type)
data$method.type <-
sub("mergesort_w", "Mergesort", data$method.type)
data$method.type <-
sub("merge_insertsort", "Mergesort.Insertion", data$method.type)
data$method.type <-
sub("quicksort_insertion", "Quicksort.Insertion", data$method.type)
data$method.type <-
sub("quickmergesort", "Quick.Merge.Insertion", data$method.type)
data$method.type <-
sub("mergecmp", "Merge.Sorted.Test", data$method.type)
data$method.type <- factor(data$method.type,
labels=c("Insertion", "Quicksort", "Mergesort",
"Quicksort.Insertion", "Mergesort.Insertion",
"Merge.Sorted.Test", "Quick.Merge.Insertion",
"Merge.Quick.Sorted"))
data$insertion.threshold <- as.factor(data$insertion.threshold)
data$sort.factor <- factor(data$sort.factor,
levels=c("0.01", "0.02", "0.03", "0.04", "0.05",
"0.06", "0.07", "0.08", "0.09", "0.1", "0.2",
"0.3", "0.4", "0.5", "0.6", "0.7", "0.8",
"0.9", "0.99", "0.999", "1"),
labels=c("1 %", "2 %", "3 %", "4 %", "5 %",
"6 %", "7 %", "8 %", "9 %", "10 %", "20 %",
"30 %", "40 %", "50 %", "60 %", "70 %",
"80 %", "90 %", "99 %", "99.9 %", "100 %"))
data
}
extract <- function(data, threshold, sortfactor) {
valid <-
data$insertion.threshold == threshold & data$sort.factor == sortfactor
data[valid, ]
}
filter.method <- function(data, name) {
data[data$method.type != name, ]
}
means <- function(d) {
aggregate(list(time=d$time), by=list(n=d$n, method.type=d$method.type,
sort.factor=d$sort.factor,
threshold=d$insertion.threshold), mean)
}