Skip to contents

If spec is a function, it is wrapped with as_rank_weight().

Usage

register_rank_weight(name, spec)

Arguments

name

Character scalar registry key.

spec

A rank_weight spec or function (ranks, ctx) -> numeric(n).

Value

Invisibly, the registered spec.

Examples

nm <- "tmp_rank_demo"
register_rank_weight(nm, function(ranks) rep(1 / length(ranks), length(ranks)))
nm %in% rank_weight_names()
#> [1] TRUE