Companions to set_weights(): read the stored scheme, test whether one is set,
or remove it.
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.
See also
set_weights(), weight_vector().
Other weighting:
clear_weights_cache(),
set_weights(),
weight_vector()
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()
