Skip to contents

Internal function to identify predictor types. The supported types are:

  • "numeric": all predictors belong to the classes "numeric" and/or "integer".

  • "categorical": all predictors belong to the classes "character" and/or "factor".

  • "mixed": predictors are of types "numeric" and "categorical".

  • "unknown": predictors of unknown type.

Usage

identify_predictors_type(df = NULL, predictors = NULL)

Arguments

df

(required; data frame, tibble, or sf) A data frame with responses and predictors. Default: NULL.

predictors

(optional; character vector) Names of the predictors to select from df. If omitted, all numeric columns in df are used instead. If argument response is not provided, non-numeric variables are ignored. Default: NULL

Value

character string: predictors type

Examples


identify_predictors_type(
  df = vi,
  predictors = vi_predictors
)
#> [1] "mixed"

identify_predictors_type(
  df = vi,
  predictors = vi_predictors_numeric
)
#> [1] "numeric"

identify_predictors_type(
  df = vi,
  predictors = vi_predictors_categorical
)
#> [1] "categorical"