var_to_keep: Decide which variable to keep

View source: R/to_keep.R

var_to_keepR Documentation

Decide which variable to keep

Description

Decide which variable to keep

Usage

var_to_keep(
  values,
  n_kept = NULL,
  prop_kept = NULL,
  cutoff = NULL,
  maximize = TRUE
)

Arguments

values

A numeric vector, with one value per variable to keep or discard.

n_kept

Number of variables to keep.

prop_kept

A numeric value between 0 and 1 representing the proportion of variables to keep. n_kept and prop_kept are mutually exclusive.

cutoff

Threshold beyond which (below or above) the variables are discarded.

maximize

Whether to minimize (FALSE) or maximize (TRUE, the default) the quantity given by values.

Value

A logical vector indicating if variables are kept or discarded.

Author(s)

Antoine Bichat

Examples

scimo:::var_to_keep(1:5, n_kept = 3, maximize = TRUE)
scimo:::var_to_keep(1:10, cutoff = 8, maximize = FALSE)

scimo documentation built on June 24, 2024, 5:17 p.m.