2 t <- read.csv("task-6498-results.csv", stringsAsFactors = FALSE)
3 t <- t[t$valid_after < paste(Sys.Date() - 1, "23:59:59"), ]
5 data.frame(t[t$ports == "80-443-554-1755", c(1, 6, 7)], var = "fast"),
6 data.frame(t[t$ports == "80-443", c(1, 6, 7)], var = "both"))
7 r <- cast(t, valid_after ~ var, value = "relays", fun.aggregate = max)
8 e <- cast(t, valid_after ~ var, value = "exit_prob",
11 data.frame(valid_after = r$valid_after, value = r$fast,
12 variable = "fastnum"),
13 data.frame(valid_after = r$valid_after, value = r$both - r$fast,
14 variable = "almostnum"),
15 data.frame(valid_after = e$valid_after, value = 100 * e$fast,
16 variable = "fastprob"),
17 data.frame(valid_after = e$valid_after, value = 100 * (e$both - e$fast),
18 variable = "almostprob"))
19 t <- aggregate(list(value = t$value),
20 by = list(date = as.Date(cut.Date(as.Date(t$valid_after), "day")),
21 variable = t$variable), FUN = median)
22 t <- cast(t, date ~ variable, value = "value", fun.aggregate = max)
23 t <- data.frame(date = t$date, round(t[, 2:3], 0), round(t[, 4:5], 2))
24 write.csv(t, "fast-exits.csv", quote = FALSE, row.names = FALSE)