Skip to content

Commit

Permalink
Clean up deprecated args, lintr (#973)
Browse files Browse the repository at this point in the history
* Clean up deprecated args, lintr

* desc, news

* update
  • Loading branch information
strengejacke authored May 26, 2024
1 parent 9638b18 commit 6090602
Show file tree
Hide file tree
Showing 12 changed files with 113 additions and 186 deletions.
4 changes: 2 additions & 2 deletions 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.21.7.1
Version: 0.21.7.2
Authors@R:
c(person(given = "Daniel",
family = "Lüdecke",
Expand Down Expand Up @@ -218,4 +218,4 @@ Config/Needs/website:
r-lib/pkgdown,
easystats/easystatstemplate
Config/rcmdcheck/ignore-inconsequential-notes: true
Remotes: easystats/insight, easystats/datawizard, easystats/performance, easystats/bayestestR
Remotes: easystats/insight, easystats/datawizard, easystats/performance, easystats/bayestestR, easystats/effectsize
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# parameters 0.21.8

## Breaking changes

* Deprecated arguments in `model_parameters()` for `htest`, `aov` and
`BFBayesFactor` objects were removed.

# parameters 0.21.7

## Changes
Expand Down
2 changes: 1 addition & 1 deletion R/dof_kenward.R
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ dof_kenward <- function(model) {

Gp <- lme4::getME(model, "Gp")
n.RT <- length(Gp) - 1 ## Number of random terms (i.e. of (|)'s)
n.lev.by.RT <- sapply(lme4::getME(model, "flist"), function(x) length(levels(x)))
n.lev.by.RT <- sapply(lme4::getME(model, "flist"), nlevels)
n.comp.by.RT <- .get.RT.dim.by.RT(model)
n.parm.by.RT <- (n.comp.by.RT + 1) * n.comp.by.RT / 2
n.RE.by.RT <- diff(Gp)
Expand Down
42 changes: 18 additions & 24 deletions R/methods_BayesFactor.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#' @inheritParams bayestestR::describe_posterior
#' @inheritParams p_value
#' @inheritParams model_parameters.htest
#' @param cohens_d,cramers_v Deprecated. Please use `effectsize_type`.
#'
#' @details
#' The meaning of the extracted parameters:
Expand All @@ -29,24 +28,26 @@
#' the *g* parameters; See the *Bayes Factors for ANOVAs* paper
#' (\doi{10.1016/j.jmp.2012.08.001}).
#'
#' @examples
#' @examplesIf require("BayesFactor")
#' \donttest{
#' if (require("BayesFactor")) {
#' # Bayesian t-test
#' model <- ttestBF(x = rnorm(100, 1, 1))
#' model_parameters(model)
#' model_parameters(model, cohens_d = TRUE, ci = .9)
#' # Bayesian t-test
#' model <- BayesFactor::ttestBF(x = rnorm(100, 1, 1))
#' model_parameters(model)
#' model_parameters(model, effectsize_type = "cohens_d", ci = 0.9)
#'
#' # Bayesian contingency table analysis
#' data(raceDolls)
#' bf <- contingencyTableBF(raceDolls, sampleType = "indepMulti", fixedMargin = "cols")
#' model_parameters(bf,
#' centrality = "mean",
#' dispersion = TRUE,
#' verbose = FALSE,
#' effectsize_type = "cramers_v"
#' )
#' }
#' # Bayesian contingency table analysis
#' data(raceDolls)
#' bf <- BayesFactor::contingencyTableBF(
#' raceDolls,
#' sampleType = "indepMulti",
#' fixedMargin = "cols"
#' )
#' model_parameters(bf,
#' centrality = "mean",
#' dispersion = TRUE,
#' verbose = FALSE,
#' effectsize_type = "cramers_v"
#' )
#' }
#' @return A data frame of indices related to the model's parameters.
#' @export
Expand All @@ -62,16 +63,9 @@ model_parameters.BFBayesFactor <- function(model,
effectsize_type = NULL,
include_proportions = FALSE,
verbose = TRUE,
cohens_d = NULL,
cramers_v = NULL,
...) {
insight::check_if_installed("BayesFactor")

## TODO: remove in a later update
# handle deprected arguments ------
if (!is.null(cramers_v)) effectsize_type <- "cramers_v"
if (!is.null(cohens_d)) effectsize_type <- "cohens_d"

if (any(startsWith(names(model@numerator), "Null"))) {
if (isTRUE(verbose)) {
insight::format_alert(
Expand Down
30 changes: 16 additions & 14 deletions R/methods_DirichletReg.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,22 @@ model_parameters.DirichletRegModel <- function(model,

## TODO check merge by

junk <- utils::capture.output(out <- .model_parameters_generic( # nolint
model = model,
ci = ci,
component = component,
bootstrap = bootstrap,
iterations = iterations,
merge_by = merge_by,
standardize = standardize,
exponentiate = exponentiate,
p_adjust = p_adjust,
keep_parameters = keep,
drop_parameters = drop,
...
))
junk <- utils::capture.output({
out <- .model_parameters_generic(
model = model,
ci = ci,
component = component,
bootstrap = bootstrap,
iterations = iterations,
merge_by = merge_by,
standardize = standardize,
exponentiate = exponentiate,
p_adjust = p_adjust,
keep_parameters = keep,
drop_parameters = drop,
...
)
})

out$Response[is.na(out$Response)] <- ""
attr(out, "object_name") <- insight::safe_deparse_symbol(substitute(model))
Expand Down
28 changes: 0 additions & 28 deletions R/methods_aov.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#' (e.g., `"g"`, `"l"`, `"two"`...). See section *One-Sided CIs* in
#' the [effectsize_CIs vignette](https://easystats.github.io/effectsize/).
#' @inheritParams model_parameters.default
#' @param omega_squared,eta_squared,epsilon_squared Deprecated. Please use `effectsize_type`.
#' @param ... Arguments passed to [`effectsize::effectsize()`]. For example,
#' to calculate _partial_ effect sizes types, use `partial = TRUE`. For objects
#' of class `htest` or `BFBayesFactor`, `adjust = TRUE` can be used to return
Expand Down Expand Up @@ -110,34 +109,7 @@ model_parameters.aov <- function(model,
drop = NULL,
table_wide = FALSE,
verbose = TRUE,
omega_squared = NULL,
eta_squared = NULL,
epsilon_squared = NULL,
...) {
## TODO: remove in a later update
# handle deprected arguments ------
if (!is.null(omega_squared)) {
insight::format_warning(
"Argument `omega_squared` is deprecated.",
"Please use `effectsize_type = \"omega\"` instead."
)
effectsize_type <- "omega"
}
if (!is.null(eta_squared)) {
insight::format_warning(
"Argument `eta_squared` is deprecated.",
"Please use `effectsize_type = \"eta\"` instead."
)
effectsize_type <- "eta"
}
if (!is.null(epsilon_squared)) {
insight::format_warning(
"Argument `epsilon_squared` is deprecated.",
"Please use `effectsize_type = \"epsilon\"` instead."
)
effectsize_type <- "epsilon"
}

# save model object, for later checks
original_model <- model
object_name <- insight::safe_deparse_symbol(substitute(model))
Expand Down
Loading

0 comments on commit 6090602

Please sign in to comment.