In computeAvgCommunProb_LR_Avg (modeling.R L1276) and computeAvgCommunProb_LR_Sum (L1345):
dataLR_percent <- 1 * (format(dataLR_temp[, -1], digits = 1) >= min.percent)
format() returns a character string. For small values, R uses scientific notation:
format(0.00032, digits = 1)
# [1] "3e-04"
"3e-04" >= 0.005
# [1] TRUE # lexicographic: "3" > "0" → TRUE
# Should be FALSE because 0.00032 < 0.005
Fix: Replace format() with direct numeric comparison in both functions:
# Before (bug):
dataLR_percent <- 1 * (format(dataLR_temp[, -1], digits = 1) >= min.percent)
# After (fix):
dataLR_percent <- 1 * (dataLR_temp[, -1] >= min.percent)