Evaluate rank-weight for a single target
Arguments
- spec
Rank-weight spec (see
is_rank_weight()).- ranks
Integer permutation of
1..n(lengthn).- ctx
Optional context (if the spec uses it).
Examples
rw <- as_rank_weight(function(r) rep(1 / length(r), length(r)))
rank_weight_eval(rw, c(2L, 1L, 3L))
#> [1] 0.3333333 0.3333333 0.3333333