Skip to content

Commit ac2eb02

Browse files
authored
Test on latest datawizard (#1050)
* Prepare CRAN release (#1047) * Prepare CRAN release * update deps * Update DESCRIPTION * fix * submit * fix docs ref * trigger CI * use explicit arguments * fix * desc * fixes * fix
1 parent 13b6b07 commit ac2eb02

File tree

8 files changed

+51
-54
lines changed

8 files changed

+51
-54
lines changed

DESCRIPTION

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Type: Package
22
Package: parameters
33
Title: Processing of Model Parameters
4-
Version: 0.24.0
4+
Version: 0.24.0.2
55
Authors@R:
66
c(person(given = "Daniel",
77
family = "Lüdecke",
@@ -167,7 +167,7 @@ Suggests:
167167
metafor,
168168
mfx,
169169
mgcv,
170-
mice,
170+
mice (>= 3.17.0),
171171
mmrm,
172172
multcomp,
173173
MuMIn,
@@ -224,3 +224,4 @@ Config/testthat/edition: 3
224224
Config/testthat/parallel: true
225225
Config/Needs/website: easystats/easystatstemplate
226226
Config/rcmdcheck/ignore-inconsequential-notes: true
227+
Remotes: easystats/datawizard

R/dominance_analysis.R

Lines changed: 37 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -529,58 +529,54 @@ dominance_analysis <- function(model, sets = NULL, all = NULL,
529529
datawizard::data_relocate(da_df_res, "subset", after = "ranks")
530530

531531
if (conditional) {
532-
da_df_cdl <-
533-
.data_frame(Subset = names(domir_res$General_Dominance))
534-
535-
da_df_cdl <-
536-
datawizard::data_merge(
537-
da_df_cdl,
538-
.data_frame(
539-
Subset = names(domir_res$General_Dominance),
540-
domir_res$Conditional_Dominance
541-
)
542-
)
532+
da_df_cdl <- .data_frame(Subset = names(domir_res$General_Dominance))
543533

544-
da_df_cdl <-
545-
datawizard::data_rename(
546-
da_df_cdl,
547-
names(da_df_cdl)[2:length(da_df_cdl)],
548-
colnames(domir_res$Conditional_Dominance)
534+
da_df_cdl <- datawizard::data_merge(
535+
da_df_cdl,
536+
.data_frame(
537+
Subset = names(domir_res$General_Dominance),
538+
domir_res$Conditional_Dominance
549539
)
540+
)
541+
542+
cols_to_select <- colnames(da_df_cdl)[2:length(da_df_cdl)]
543+
da_df_cdl <- datawizard::data_rename(
544+
da_df_cdl,
545+
select = cols_to_select,
546+
replacement = colnames(domir_res$Conditional_Dominance)
547+
)
550548
} else {
551549
da_df_cdl <- NULL
552550
}
553551

554552
if (complete) {
555-
da_df_cpt <-
556-
.data_frame(Subset = names(domir_res$General_Dominance))
557-
558-
da_df_cpt <-
559-
datawizard::data_merge(
560-
da_df_cpt,
561-
.data_frame(
562-
Subset = names(domir_res$General_Dominance),
563-
domir_res$Complete_Dominance
564-
)
565-
)
553+
da_df_cpt <- .data_frame(Subset = names(domir_res$General_Dominance))
566554

567-
da_df_cpt <-
568-
datawizard::data_rename(
569-
da_df_cpt,
570-
names(da_df_cpt)[2:length(da_df_cpt)],
571-
colnames(domir_res$Complete_Dominance)
555+
da_df_cpt <- datawizard::data_merge(
556+
da_df_cpt,
557+
.data_frame(
558+
Subset = names(domir_res$General_Dominance),
559+
domir_res$Complete_Dominance
572560
)
561+
)
562+
563+
cols_to_select <- colnames(da_df_cpt)[2:length(da_df_cpt)]
564+
da_df_cpt <- datawizard::data_rename(
565+
da_df_cpt,
566+
select = cols_to_select,
567+
replacement = colnames(domir_res$Complete_Dominance)
568+
)
573569
} else {
574570
da_df_cpt <- NULL
575571
}
576572

577-
da_df_res <-
578-
datawizard::data_rename(da_df_res,
579-
replacement = c(
580-
"Parameter", "General_Dominance",
581-
"Percent", "Ranks", "Subset"
582-
)
573+
da_df_res <- datawizard::data_rename(
574+
da_df_res,
575+
replacement = c(
576+
"Parameter", "General_Dominance",
577+
"Percent", "Ranks", "Subset"
583578
)
579+
)
584580

585581
da_list <- list(
586582
General = da_df_res,
@@ -615,7 +611,7 @@ print.parameters_da <- function(x, digits = 3, ...) {
615611
printed_x <- x
616612

617613
printed_x$General <- datawizard::data_rename(x$General,
618-
pattern = "General_Dominance",
614+
select = "General_Dominance",
619615
replacement = "General Dominance"
620616
)
621617

@@ -628,7 +624,7 @@ print.parameters_da <- function(x, digits = 3, ...) {
628624

629625
printed_x$Conditional <-
630626
datawizard::data_rename(x$Conditional,
631-
pattern = cdl_names,
627+
select = cdl_names,
632628
replacement = cdl_names_rep
633629
)
634630
}
@@ -644,7 +640,7 @@ print.parameters_da <- function(x, digits = 3, ...) {
644640

645641
printed_x$Complete <-
646642
datawizard::data_rename(x$Complete,
647-
pattern = cpt_names,
643+
select = cpt_names,
648644
replacement = cpt_names_rep
649645
)
650646
}

R/extract_random_variances.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@
206206
# rename columns
207207
out <- datawizard::data_rename(
208208
out,
209-
pattern = c("grp", "sdcor"),
209+
select = c("grp", "sdcor"),
210210
replacement = c("Group", "Coefficient")
211211
)
212212

R/methods_glmmTMB.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ ci.glmmTMB <- function(x,
426426
method <- tolower(method)
427427
method <- insight::validate_argument(
428428
method,
429-
c("wald", "normal", "ml1", "betwithin", "profile", "uniroot", "robust")
429+
c("wald", "normal", "ml1", "betwithin", "profile", "uniroot", "robust", "residual")
430430
)
431431
component <- insight::validate_argument(
432432
component,

R/methods_mice.R

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ p_value.mipo <- function(model, ...) {
2121
p = as.vector(s$p.value)
2222
)
2323
# check for ordinal-alike models
24-
if ("y.level" %in% colnames(s)) {
25-
out$Response <- as.vector(s$y.level)
24+
if (!is.null(model$pooled) && "y.level" %in% colnames(model$pooled)) {
25+
out$Response <- as.vector(model$pooled$y.level)
2626
}
2727
out
2828
}
@@ -45,8 +45,8 @@ standard_error.mipo <- function(model, ...) {
4545
SE = as.vector(s$std.error)
4646
)
4747
# check for ordinal-alike models
48-
if ("y.level" %in% colnames(s)) {
49-
out$Response <- as.vector(s$y.level)
48+
if (!is.null(model$pooled) && "y.level" %in% colnames(model$pooled)) {
49+
out$Response <- as.vector(model$pooled$y.level)
5050
}
5151
out
5252
}
@@ -85,8 +85,7 @@ model_parameters.mipo <- function(model,
8585
)
8686

8787
# check if we have ordinal/categorical response
88-
s <- summary(model)
89-
if ("y.level" %in% colnames(s)) {
88+
if (!is.null(model$pooled) && "y.level" %in% colnames(model$pooled)) {
9089
merge_by <- c("Parameter", "Response")
9190
} else {
9291
merge_by <- "Parameter"

R/p_function.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ format.parameters_p_function <- function(x,
379379
ci <- as.character(i$CI)[1]
380380
out <- datawizard::data_rename(
381381
i,
382-
pattern = c("CI_low", "CI_high"),
382+
select = c("CI_low", "CI_high"),
383383
replacement = c(sprintf("CI_low_%s", ci), sprintf("CI_high_%s", ci))
384384
)
385385
out$CI <- NULL

tests/testthat/test-dominance_analysis.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
skip_if_not_installed("performance")
22
skip_if_not_installed("domir")
3+
skip_if_not_installed("datawizard")
34

45
DA_test_model <- lm(mpg ~ vs + cyl + carb, data = mtcars)
56

tests/testthat/test-pool_parameters.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ test_that("pooled parameters, glmmTMB, components", {
7474
)
7575
expect_equal(out$Coefficient, c(187.280225, -87.838969), tolerance = 1e-3)
7676

77-
out <- pool_parameters(models, component = "all", effects = "all")
77+
out <- suppressMessages(pool_parameters(models, component = "all", effects = "all"))
7878
expect_named(
7979
out,
8080
c(
@@ -123,7 +123,7 @@ test_that("pooled parameters, glmmTMB, zero-inflated", {
123123
)
124124
})
125125

126-
out <- pool_parameters(models)
126+
out <- pool_parameters(models, ci_method = "residual")
127127
expect_named(
128128
out,
129129
c(

0 commit comments

Comments
 (0)