R/measure_importance.R
important_variables.Rd
Get the names of k variables with highest sum of rankings based on the specified importance measures
A result of using the function measure_importance() to a random forest or a randomForest object
The number of variables to extract
A character vector specifying the measures of importance to be used
One of three: c("none", "all", "draw"); specifies which variables to pick when ties occur. When set to "none" we may get less than k variables, when "all" we may get more and "draw" makes us get exactly k.
A character vector with names of k variables with highest sum of rankings
forest <- randomForest::randomForest(Species ~ ., data = iris, localImp = TRUE, ntree = 300)
important_variables(measure_importance(forest), k = 2)
#> [1] "Petal.Width" "Petal.Length"