diff --git a/R/format_parameters.R b/R/format_parameters.R index 9e21d599f..ec3f2b0db 100644 --- a/R/format_parameters.R +++ b/R/format_parameters.R @@ -507,6 +507,13 @@ format_parameters.parameters_model <- function(model, ...) { for (i in names(interactions)) { # extract single coefficient names from interaction term out <- unlist(strsplit(i, ":", fixed = TRUE)) + # for on-the-fly conversion of factors, the names of the factors can + # can also contain "factor()" or "as.factor()" - we need to remove these + if (any(grepl("(as\\.factor|factor|as\\.character)", out))) { + out_clean <- gsub("(as\\.factor|factor|as\\.character)\\((.*)\\)(.*)", "\\2", out) + } else { + out_clean <- out + } # combine labels labs <- c( labs, diff --git a/R/utils_model_parameters.R b/R/utils_model_parameters.R index 356305752..8466d1da0 100644 --- a/R/utils_model_parameters.R +++ b/R/utils_model_parameters.R @@ -215,7 +215,11 @@ } # add parameters with value and variable - attr(params, "pretty_labels") <- .format_value_labels(params, model) + if (isFALSE(dot.arguments$pretty_names)) { + attr(params, "pretty_labels") <- params$Parameter + } else if (is.null(attr(params, "pretty_labels", exact = TRUE))) { + attr(params, "pretty_labels") <- .format_value_labels(params, model) + } row.names(params) <- NULL params