commit e38c698ccd9adcbba4b98994dd31571275186aca Author: Karsten Loesing karsten.loesing@gmx.net Date: Fri Dec 6 08:44:09 2013 +0100
Add script to merge userstats with detector results (#8462) --- task-8462/merge-clients.R | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
diff --git a/task-8462/merge-clients.R b/task-8462/merge-clients.R new file mode 100644 index 0000000..4a32ff1 --- /dev/null +++ b/task-8462/merge-clients.R @@ -0,0 +1,19 @@ +require(reshape) +r <- read.csv("userstats-ranges.csv", stringsAsFactors = FALSE) +r <- melt(r, id.vars = c("date", "country")) +r <- data.frame(date = r$date, node = "relay", country = r$country, + transport = "", version = "", + variable = ifelse(r$variable == "maxusers", "upper", "lower"), + value = floor(r$value)) +u <- read.csv("userstats.csv", stringsAsFactors = FALSE) +u <- melt(u, id.vars = c("date", "node", "country", "transport", + "version")) +u <- data.frame(date = u$date, node = u$node, country = u$country, + transport = u$transport, version = u$version, + variable = ifelse(u$variable == "frac", "frac", "clients"), + value = u$value) +c <- rbind(r, u) +c <- cast(c, date + node + country + transport + version ~ variable) +c <- c[order(c$date, c$node, c$country, c$transport, c$version), ] +write.csv(c, "clients.csv", quote = FALSE, row.names = FALSE, na = "") +
tor-commits@lists.torproject.org