From adb819466942b7d05335089f3e6307c8dda2e730 Mon Sep 17 00:00:00 2001
From: saskiaotto <saskia.otto@uni-hamburg.de>
Date: Mon, 22 Mar 2021 22:12:24 +0100
Subject: [PATCH] changed adding constant for cases when =% and 20% percentile
 are the same (and hence br[sel] is zero)

---
 R/trafficlight.R | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/R/trafficlight.R b/R/trafficlight.R
index 63d5212..a096a4c 100644
--- a/R/trafficlight.R
+++ b/R/trafficlight.R
@@ -107,7 +107,7 @@ trafficlight <- function(x, time = NULL, sort_5yrmean = TRUE, sort_vec = NULL,
     br <- stats::quantile(v, probs = probs, na.rm = TRUE, type = type)
     if (any(diff(br) == 0)) {
       sel <- which(diff(br) == 0)
-      br[sel+1] <- br[sel+1] + br[sel]/10000
+      br[sel+1] <- br[sel+1] + 0.0001 # br[sel]/10000
       print(paste0("For variable '", var, "' the ", probs[sel+1]*100,
         "%-quantile is the same as the ", probs[sel]*100,
         "%-quantile. All values are grouped under the lower quantile!"))
-- 
GitLab