Skip to content

Scorecards extreme values

      # To avoid extremes such 0.999 correlation to become 1 and therefore white
      # expects metric dimension to be in the first position in data_sc_1
      for (met in 1:length(metrics)){
        if (is.null(legend.col.inf[[met]])) {
          pos <- which(round(data_sc_1[met,,,], 2) == legend.breaks[[met]][1])
          if (length(pos) > 1) {
            sub <- Subset(data_sc_1, along = 'metric', indices = met)
            sub[pos] <- sub[pos] + 0.01
            data_sc_1[met,,,] <- sub
          }
        }
        if (is.null(legend.col.sup[[met]])) {
          pos <- which(round(data_sc_1[met,,,], 2) ==
                       legend.breaks[[met]][length(legend.breaks[[met]])])
          if (length(pos) > 1) {
            sub <- Subset(data_sc_1, along = 'metric', indices = met)
            sub[pos] <- sub[pos] - 0.01
            data_sc_1[met,,,] <- sub
          }
        }
      }