Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: parameters
Title: Processing of Model Parameters
Version: 0.28.2
Version: 0.28.2.1
Authors@R:
c(person(given = "Daniel",
family = "Lüdecke",
Expand Down
9 changes: 8 additions & 1 deletion R/format_parameters.R
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,15 @@ 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, paste(sapply(out, function(l) pretty_labels[l]), collapse = " * "))
labs <- c(labs, paste(sapply(out_clean, function(l) pretty_labels[l]), collapse = " * "))
}
# add interaction terms to labels string
names(labs) <- names(interactions)
Expand Down
6 changes: 5 additions & 1 deletion R/utils_model_parameters.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#'
#' @keywords internal
#' @noRd
.add_model_parameters_attributes <- function(params,

Check warning on line 7 in R/utils_model_parameters.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/utils_model_parameters.R,line=7,col=1,[cyclocomp_linter] Reduce the cyclomatic complexity of this expression from 43 to at most 40.
model,
ci,
exponentiate = FALSE,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -254,7 +258,7 @@
#'
#' @keywords internal
#' @noRd
.find_coefficient_type <- function(info, exponentiate, model = NULL) {

Check warning on line 261 in R/utils_model_parameters.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/utils_model_parameters.R,line=261,col=1,[cyclocomp_linter] Reduce the cyclomatic complexity of this expression from 57 to at most 40.
# column name for coefficients
coef_col <- "Coefficient"
if (!is.null(model) && inherits(model, "emmGrid")) {
Expand Down
Loading