set_keys | R Documentation |
'keys' are a set of column(s) which identify a group of rules in a rulelist. Methods like predict, augment produce output per key combination.
set_keys(x, keys, reset = FALSE)
x |
A rulelist |
keys |
(character vector or NULL) |
reset |
(flag) Whether to reset the keys to sequential numbers starting
with 1 when |
A new rulelist is returned with attr keys
is modified. The input
rulelist object is unaltered.
A rulelist object
rulelist, tidy, augment, predict, calculate, prune, reorder
Other Core Rulelist Utility:
set_validation_data()
model_c5 = C50::C5.0(Attrition ~., data = modeldata::attrition, rules = TRUE)
tidy_c5 = tidy(model_c5)
tidy_c5 # keys are: "trial_nbr"
tidy_c5[["rule_nbr"]] = 1:nrow(tidy_c5)
new_tidy_c5 = set_keys(tidy_c5, NULL) # remove all keys
new_tidy_c5
new_2_tidy_c5 = set_keys(new_tidy_c5, "trial_nbr") # set "trial_nbr" as key
new_2_tidy_c5
# Note that `tidy_c5` and `new_tidy_c5` are not altered.
tidy_c5
new_tidy_c5
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.