Skip to content

Commit

Permalink
Bug: pretty_names = "labels" does not work for AER::tobit models
Browse files Browse the repository at this point in the history
Fixes #987
  • Loading branch information
strengejacke committed Jul 20, 2024
1 parent 82cf1b3 commit 0caa7b9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions R/format_parameters.R
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,12 @@ format_parameters.parameters_model <- function(model, ...) {
if (!is.null(model) && insight::is_regression_model(model) && !is.data.frame(model)) {
# get data, but exclude response - we have no need for that label
mf <- insight::get_data(model, source = "mf", verbose = FALSE)
# sanity check - any labels?
has_labels <- vapply(mf, function(i) !is.null(attr(i, "labels", exact = TRUE)), logical(1))
# if we don't have labels, we try to get data from environment
if (!any(has_labels)) {
mf <- insight::get_data(model, source = "environment", verbose = FALSE)
}
resp <- insight::find_response(model, combine = FALSE)
mf <- mf[, setdiff(colnames(mf), resp), drop = FALSE]

Expand Down

0 comments on commit 0caa7b9

Please sign in to comment.