light_recode | R Documentation |
Recodes factor levels of columns in data slots of an object of class "light".
light_recode(x, ...)
## Default S3 method:
light_recode(x, ...)
## S3 method for class 'light'
light_recode(x, what, levels, labels, ...)
x |
An object of class "light". |
... |
Further arguments passed to |
what |
Column identifier to be recoded, e.g., "type". For backward compatibility, also the option identifier (e.g. "type_name") can be passed. |
levels |
Current levels/values of |
labels |
New levels of |
x
with new factor levels of type_name
column.
light_recode(default)
: Default method not implemented yet.
light_recode(light)
: Recoding factors in data slots of "light" object.
plot.light_effects()
.
fit_full <- lm(Sepal.Length ~ ., data = iris)
fit_part <- lm(Sepal.Length ~ Petal.Length, data = iris)
mod_full <- flashlight(
model = fit_full, label = "full", data = iris, y = "Sepal.Length"
)
mod_part <- flashlight(
model = fit_part, label = "part", data = iris, y = "Sepal.Length"
)
mods <- multiflashlight(list(mod_full, mod_part))
eff <- light_effects(mods, v = "Species")
eff <- light_recode(
eff,
what = "type_name",
levels = c("response", "predicted", "partial dependence", "ale"),
labels = c("Observed", "Fitted", "PD", "ALE")
)
plot(eff, use = "all")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.