From d3a6a95d81611d82bdb5d914ad68d8018b8dd82d Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 13 Sep 2023 08:10:09 +0200 Subject: [PATCH] CRAN submission 0.21.2 --- DESCRIPTION | 4 ++-- NEWS.md | 2 +- R/display.R | 2 +- R/format.R | 6 +++--- R/print.parameters_model.R | 10 +++++----- R/print_html.R | 4 ++-- R/print_md.R | 4 ++-- R/utils_format.R | 8 ++++---- man/display.parameters_model.Rd | 10 +++++----- man/print.parameters_model.Rd | 4 ++-- tests/testthat/test-printing_reference_level.R | 10 +++++----- 11 files changed, 32 insertions(+), 32 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index b5a22cec2..9d17a9495 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: parameters Title: Processing of Model Parameters -Version: 0.21.1.9 +Version: 0.21.1.10 Authors@R: c(person(given = "Daniel", family = "Lüdecke", @@ -81,7 +81,7 @@ Depends: Imports: bayestestR (>= 0.13.0), datawizard (>= 0.7.0), - insight (>= 0.19.3.2), + insight (>= 0.19.4), graphics, methods, stats, diff --git a/NEWS.md b/NEWS.md index e7e71641c..c52c21fde 100644 --- a/NEWS.md +++ b/NEWS.md @@ -11,7 +11,7 @@ accepts the `exponentiate` argument. * The `print()`, `print_html()`, `print_md()` and `format()` methods for - `model_parameters()` get an `add_reference` argument, to add the reference + `model_parameters()` get an `include_reference` argument, to add the reference category of categorical predictors to the parameters table. ## Bug fixes diff --git a/R/display.R b/R/display.R index e9549821a..036d28154 100644 --- a/R/display.R +++ b/R/display.R @@ -91,7 +91,7 @@ display.parameters_model <- function(object, font_size = "100%", line_padding = 4, column_labels = NULL, - add_reference = FALSE, + include_reference = FALSE, verbose = TRUE, ...) { if (identical(format, "html")) { diff --git a/R/format.R b/R/format.R index d006b6447..5c09ca3d0 100644 --- a/R/format.R +++ b/R/format.R @@ -15,7 +15,7 @@ format.parameters_model <- function(x, zap_small = FALSE, format = NULL, groups = NULL, - add_reference = FALSE, + include_reference = FALSE, ...) { # save attributes coef_name <- attributes(x)$coefficient_name @@ -168,7 +168,7 @@ format.parameters_model <- function(x, ci_width = ci_width, ci_brackets = ci_brackets, zap_small = zap_small, - add_reference = add_reference, + include_reference = include_reference, ... ) } else { @@ -185,7 +185,7 @@ format.parameters_model <- function(x, format = format, coef_name = coef_name, zap_small = zap_small, - add_reference = add_reference, + include_reference = include_reference, ... ) } diff --git a/R/print.parameters_model.R b/R/print.parameters_model.R index debe8dd20..95910b731 100644 --- a/R/print.parameters_model.R +++ b/R/print.parameters_model.R @@ -87,7 +87,7 @@ #' labels will be used as parameters names. The latter only works for "labelled" #' data, i.e. if the data used to fit the model had `"label"` and `"labels"` #' attributes. See also section _Global Options to Customize Messages when Printing_. -#' @param add_reference Logical, if `TRUE`, the reference level of factors will +#' @param include_reference Logical, if `TRUE`, the reference level of factors will #' be added to the parameters table. This is only relevant for models with #' categorical predictors. The coefficient for the reference level is always #' `0` (except when `exponentiate = TRUE`, then the coefficient will be `1`), @@ -238,7 +238,7 @@ print.parameters_model <- function(x, groups = NULL, column_width = NULL, ci_brackets = c("[", "]"), - add_reference = FALSE, + include_reference = FALSE, ...) { # save original input orig_x <- x @@ -288,7 +288,7 @@ print.parameters_model <- function(x, ci_brackets = ci_brackets, format = "text", groups = groups, - add_reference = add_reference, + include_reference = include_reference, ... ) @@ -385,7 +385,7 @@ print.parameters_random <- function(x, digits = 2, ...) { ci_brackets = TRUE, format = "text", group = NULL, - add_reference = FALSE, + include_reference = FALSE, ...) { format( x, @@ -400,7 +400,7 @@ print.parameters_random <- function(x, digits = 2, ...) { zap_small = zap_small, format = format, group = group, - add_reference = add_reference, + include_reference = include_reference, ... ) } diff --git a/R/print_html.R b/R/print_html.R index 5be9f9b98..42bae3da7 100644 --- a/R/print_html.R +++ b/R/print_html.R @@ -22,7 +22,7 @@ print_html.parameters_model <- function(x, font_size = "100%", line_padding = 4, column_labels = NULL, - add_reference = FALSE, + include_reference = FALSE, verbose = TRUE, ...) { # check if user supplied digits attributes @@ -83,7 +83,7 @@ print_html.parameters_model <- function(x, ci_brackets = ci_brackets, format = "html", groups = groups, - add_reference = add_reference, + include_reference = include_reference, ... ) diff --git a/R/print_md.R b/R/print_md.R index d95e7fe58..264a42bef 100644 --- a/R/print_md.R +++ b/R/print_md.R @@ -19,7 +19,7 @@ print_md.parameters_model <- function(x, show_formula = FALSE, zap_small = FALSE, groups = NULL, - add_reference = FALSE, + include_reference = FALSE, verbose = TRUE, ...) { # check if user supplied digits attributes @@ -67,7 +67,7 @@ print_md.parameters_model <- function(x, ci_brackets = ci_brackets, format = "markdown", groups = groups, - add_reference = add_reference, + include_reference = include_reference, ... ) diff --git a/R/utils_format.R b/R/utils_format.R index 144f139ab..941f3bfc3 100644 --- a/R/utils_format.R +++ b/R/utils_format.R @@ -280,7 +280,7 @@ format = NULL, coef_name = NULL, zap_small = FALSE, - add_reference = FALSE, + include_reference = FALSE, ...) { # default brackets are parenthesis for HTML / MD if ((is.null(ci_brackets) || isTRUE(ci_brackets)) && (identical(format, "html") || identical(format, "markdown"))) { @@ -310,7 +310,7 @@ } # add the coefficient for the base-(reference)-level of factors? - if (add_reference) { + if (include_reference) { x <- .add_reference_level(x) } @@ -851,7 +851,7 @@ ci_width = "auto", ci_brackets = TRUE, zap_small = FALSE, - add_reference = FALSE, + include_reference = FALSE, ...) { final_table <- list() @@ -1052,7 +1052,7 @@ } # add the coefficient for the base-(reference)-level of factors? - if (add_reference) { + if (include_reference) { tables[[type]] <- .add_reference_level(tables[[type]]) } diff --git a/man/display.parameters_model.Rd b/man/display.parameters_model.Rd index 263fe680a..a94a13408 100644 --- a/man/display.parameters_model.Rd +++ b/man/display.parameters_model.Rd @@ -33,7 +33,7 @@ font_size = "100\%", line_padding = 4, column_labels = NULL, - add_reference = FALSE, + include_reference = FALSE, verbose = TRUE, ... ) @@ -75,7 +75,7 @@ zap_small = FALSE, format = NULL, groups = NULL, - add_reference = FALSE, + include_reference = FALSE, ... ) @@ -100,7 +100,7 @@ font_size = "100\%", line_padding = 4, column_labels = NULL, - add_reference = FALSE, + include_reference = FALSE, verbose = TRUE, ... ) @@ -123,7 +123,7 @@ show_formula = FALSE, zap_small = FALSE, groups = NULL, - add_reference = FALSE, + include_reference = FALSE, verbose = TRUE, ... ) @@ -236,7 +236,7 @@ places than \code{digits} are printed in scientific notation.} \item{column_labels}{Labels of columns for HTML tables. If \code{NULL}, automatic column names are generated. See 'Examples'.} -\item{add_reference}{Logical, if \code{TRUE}, the reference level of factors will +\item{include_reference}{Logical, if \code{TRUE}, the reference level of factors will be added to the parameters table. This is only relevant for models with categorical predictors. The coefficient for the reference level is always \code{0} (except when \code{exponentiate = TRUE}, then the coefficient will be \code{1}), diff --git a/man/print.parameters_model.Rd b/man/print.parameters_model.Rd index b66d83cd7..8df368867 100644 --- a/man/print.parameters_model.Rd +++ b/man/print.parameters_model.Rd @@ -22,7 +22,7 @@ groups = NULL, column_width = NULL, ci_brackets = c("[", "]"), - add_reference = FALSE, + include_reference = FALSE, ... ) @@ -132,7 +132,7 @@ columns across all table components are adjusted to have the same width.} \item{ci_brackets}{Logical, if \code{TRUE} (default), CI-values are encompassed in square brackets (else in parentheses).} -\item{add_reference}{Logical, if \code{TRUE}, the reference level of factors will +\item{include_reference}{Logical, if \code{TRUE}, the reference level of factors will be added to the parameters table. This is only relevant for models with categorical predictors. The coefficient for the reference level is always \code{0} (except when \code{exponentiate = TRUE}, then the coefficient will be \code{1}), diff --git a/tests/testthat/test-printing_reference_level.R b/tests/testthat/test-printing_reference_level.R index d847fcd4e..bec8507ea 100644 --- a/tests/testthat/test-printing_reference_level.R +++ b/tests/testthat/test-printing_reference_level.R @@ -5,7 +5,7 @@ # d <<- PlantGrowth # m <- lm(weight ~ group, data = d) # mp <- model_parameters(m) -# expect_snapshot(print(mp, add_reference = TRUE)) +# expect_snapshot(print(mp, include_reference = TRUE)) # data(mtcars) # d <<- mtcars @@ -13,19 +13,19 @@ # d$am <- as.factor(d$am) # m <- lm(mpg ~ hp + cyl + gear + am, data = d) # mp <- model_parameters(m) -# expect_snapshot(print(mp, add_reference = TRUE)) +# expect_snapshot(print(mp, include_reference = TRUE)) # data(iris) # d <<- iris # m <- lm(Sepal.Length ~ Sepal.Width * Species, data = d) # mp <- model_parameters(m) -# expect_snapshot(print(mp, add_reference = TRUE)) +# expect_snapshot(print(mp, include_reference = TRUE)) # data(mtcars) # d <<- mtcars # d$gear <- as.factor(d$gear) # m <- glm(vs ~ wt + gear, data = d, family = "binomial") -# expect_snapshot(print(model_parameters(m, exponentiate = TRUE, drop = "(Intercept)"), add_reference = TRUE)) +# expect_snapshot(print(model_parameters(m, exponentiate = TRUE, drop = "(Intercept)"), include_reference = TRUE)) # }) # test_that("reference for models with multiple components", { @@ -40,5 +40,5 @@ # family = glmmTMB::truncated_poisson() # ) -# print(model_parameters(m1), add_reference = TRUE) +# print(model_parameters(m1), include_reference = TRUE) # })