Skip to contents

Internal function to validate the argument encoding_method of target_encoding_lab().

Usage

validate_arg_encoding_method(
  encoding_method = "loo",
  overwrite = NULL,
  quiet = FALSE,
  function_name = NULL
)

Arguments

encoding_method

(optional; character vector or NULL). Name of the target encoding methods. One or several of: "mean", "rank", "loo". If NULL, target encoding is ignored, and df is returned with no modification. Default: "loo"

overwrite

(optional; logical) If TRUE, the original predictors in df are overwritten with their encoded versions, but only one encoding method, smoothing, white noise, and seed are allowed. Otherwise, encoded predictors with their descriptive names are added to df. Default: FALSE

quiet

(optional; logical) If FALSE, messages are printed. Default: FALSE.

function_name

(optional, character string) Name of the function performing the argument check. Default: NULL

Value

character

Examples

x <- validate_arg_encoding_method(
  encoding_method = "wrong_method"
  )
#> 
#> collinear::validate_arg_encoding_method(): argument 'encoding_method' is not valid, resetting it to 'loo'.