Skip to contents

Companions to set_weights(): read the stored scheme, test whether one is set, or remove it.

Usage

get_weights()

has_weights()

clear_weights()

Value

get_weights() returns the scheme (a named list of target vectors; error if none is set); has_weights() returns a logical; clear_weights() returns TRUE invisibly.

Details

has_weights() is the safe check before get_weights(), which errors when no scheme is set. clear_weights() turns weighting off again, so the helpers return purely unweighted results.

Examples

has_weights()
#> [1] FALSE
set_weights(c(variable = "region", Europe = 0.5, "North America" = 0.5))
#> Weighting scheme stored for: region. It applies once a dataset is in play.
get_weights()
#> $region
#>        Europe North America 
#>           0.5           0.5 
#> 
clear_weights()