[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [metrics-web/master] Fix NAs in top-10 countries by censorship events.



commit 1d492563cfd1f9f1b0d3e62a4ac6c47c011f3e38
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Tue Apr 1 11:44:22 2014 +0200

    Fix NAs in top-10 countries by censorship events.
    
    Spotted by sysrqb.
---
 website/rserve/tables.R |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/website/rserve/tables.R b/website/rserve/tables.R
index 3e5fcb4..e8c02cc 100644
--- a/website/rserve/tables.R
+++ b/website/rserve/tables.R
@@ -39,8 +39,10 @@ write_userstats_censorship_events <- function(start, end, path) {
   c <- c[c$date >= start & c$date <= end & c$country != '' &
          c$transport == '' & c$version == '' & c$node == 'relay', ]
   r <- data.frame(date = c$date, country = c$country,
-                  upturn = ifelse(c$clients > c$upper, 1, 0),
-                  downturn = ifelse(c$clients <= c$lower, 1, 0))
+                  upturn = ifelse(!is.na(c$upper) &
+                                  c$clients > c$upper, 1, 0),
+                  downturn = ifelse(!is.na(c$lower) &
+                                    c$clients <= c$lower, 1, 0))
   r <- aggregate(r[, c("upturn", "downturn")],
     by = list(country = r$country), sum)
   r <- r[!(r$country %in% c("zy", "??", "a1", "a2", "o1", "ap", "eu")), ]

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits