Assuming testing threshold is stored in dataframe called test
, you could split it row-wise and use Map
to find output for each ID
how many values are greater than each threshold.
Map(function(x, y) colSums(sapply(y, `<`, x)), df, asplit(test[-1], 1))
#$A
#value1 value2 value3 value4
# 7 7 6 5
#$B
#value1 value2 value3 value4
# 2 1 1 0
#$C
#value1 value2 value3 value4
# 2 2 2 2
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…