4 a <- read.csv("aggregated.csv", stringsAsFactors = FALSE)
7 e <- data.frame(date = as.Date(e$date), case = ifelse(
8 e$reported == "true", ifelse(e$discarded == "false", "case1", "case2"),
9 "case3"), bridges = e$bridges)
10 e <- aggregate(list(bridges = e$bridges),
11 by = list(date = e$date, case = e$case), FUN = sum)
12 e <- cast(e, date ~ case)
13 sums <- e$case1 + e$case2 + e$case3
14 e <- data.frame(date = e$date, case1 = e$case1 / sums,
15 case2 = e$case2 / sums, case3 = e$case3 / sums, stringsAsFactors = FALSE)
17 e <- data.frame(date = e$date, variable = ifelse(e$variable == "case1",
18 "reported and used", ifelse(e$variable == "case2",
19 "reported and discarded", "not reported")), value = e$value)
20 ggplot(e, aes(x = as.Date(date), y = value)) +
22 facet_grid(variable ~ .) +
23 scale_x_date(name = "") +
24 scale_y_continuous(name = "", labels = percent) +
25 opts(title = "Fraction of bridge usage statistics that were...\n")
26 ggsave("reported-bridge-statistics.png", width = 8, height = 6, dpi = 120)
29 d <- d[d$reported == "false", ]
30 d <- data.frame(date = d$date, reason = d$reason, value = d$bridges)
31 d <- cast(d, date ~ reason)
32 d <- data.frame(date = d$date, case1 = d$lessthan24h / sums,
33 case2 = d$publdelay / sums, case3 = d$other / sums)
35 d <- data.frame(date = d$date, variable = ifelse(d$variable == "case1",
36 "Less than 24h uptime", ifelse(d$variable == "case2",
37 "Publication delay", "Other reason")), value = d$value)
38 ggplot(d, aes(x = as.Date(date), y = value)) +
40 facet_grid(variable ~ .) +
41 scale_x_date(name = "") +
42 scale_y_continuous(name = "", labels = percent) +
43 opts(title = "Reasons for bridges not reporting usage statistics\n")
44 ggsave("bridge-statistics-nonreported.png", width = 8, height = 6,
48 b <- b[b$discarded == "true", ]
49 b <- data.frame(date = b$date, reason = b$reason, value = b$bridges)
50 b <- cast(b, date ~ reason)
51 b <- data.frame(date = b$date, case1 = b$geoip022 / sums,
52 case2 = b$nogeoipfile / sums, case3 = b$runasrelay / sums)
54 b <- data.frame(date = b$date, variable = ifelse(b$variable == "case1",
55 "0.2.2.x geoip-stats bug", ifelse(b$variable == "case2",
56 "missing geoip file", "Run as non-bridge relay")), value = b$value)
57 ggplot(b, aes(x = as.Date(date), y = value)) +
59 facet_grid(variable ~ .) +
60 scale_x_date(name = "") +
61 scale_y_continuous(name = "", labels = percent) +
62 opts(title = "Reasons for discarding reported usage statistics\n")
63 ggsave("bridge-statistics-discarded.png", width = 8, height = 6,