Obtain variable names, type (numeric, ordered, factor) and levels as a tibble

varSpec(object)

Arguments

object

Cubist/C5 object

Value

A tibble with three columns: variable(character), type(character) and levels(a list-column). For numeric variables, levels are set to NA.

Examples

data("attrition", package = "modeldata") attrition <- tibble::as_tibble(attrition) cols_att <- setdiff(colnames(attrition), c("MonthlyIncome", "Attrition")) cb_att <- Cubist::cubist(x = attrition[, cols_att],y = attrition[["MonthlyIncome"]]) varSpec(cb_att)
#> # A tibble: 29 x 3 #> type levels variable #> <chr> <list> <chr> #> 1 numeric <chr [1]> Age #> 2 factor <chr [3]> BusinessTravel #> 3 numeric <chr [1]> DailyRate #> 4 factor <chr [3]> Department #> 5 numeric <chr [1]> DistanceFromHome #> 6 ordered <chr [5]> Education #> 7 factor <chr [6]> EducationField #> 8 ordered <chr [4]> EnvironmentSatisfaction #> 9 factor <chr [2]> Gender #> 10 numeric <chr [1]> HourlyRate #> # … with 19 more rows