Skip to content
Merged
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
4 changes: 3 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ BugReports: https://github.com/insightsengineering/cardx/issues
Depends:
R (>= 4.2)
Imports:
cards (>= 0.7.0),
cards (>= 0.7.1.9008),
cli (>= 3.6.1),
dplyr (>= 1.2.0),
glue (>= 1.6.2),
Expand All @@ -46,6 +46,8 @@ Suggests:
survival (>= 3.6-4),
testthat (>= 3.2.0),
withr (>= 2.5.0)
Remotes:
insightsengineering/cards@main
Config/Needs/website: insightsengineering/nesttemplate
Config/testthat/edition: 3
Config/testthat/parallel: true
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# cardx 0.3.2.9000

* Added fix to ensure `as_card` does not error after update to `cards`

# cardx 0.3.2

* Swapped internal use of `dplyr::case_when()` for `dplyr::recode_values()` as the former is now deprecated. (#327)
Expand Down
2 changes: 1 addition & 1 deletion R/ard_aod_wald_test.R
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ ard_aod_wald_test <- function(x, tidy_fun = broom.helpers::tidy_with_broom_or_pa
warning = wald_test["warning"],
error = wald_test["error"]
) |>
cards::as_card() |>
cards::as_card(check = FALSE) |>
cards::tidy_ard_column_order()
}

Expand Down
2 changes: 1 addition & 1 deletion R/ard_car_anova.R
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ ard_car_anova <- function(x, ...) {
warning = car_anova["warning"],
error = car_anova["error"]
) |>
cards::as_card() |>
cards::as_card(check = FALSE) |>
cards::tidy_ard_column_order()
}
2 changes: 1 addition & 1 deletion R/ard_car_vif.R
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,6 @@ ard_car_vif <- function(x, ...) {

# Clean up return object
vif_return |>
cards::as_card() |>
cards::as_card(check = FALSE) |>
cards::tidy_ard_column_order()
}
4 changes: 2 additions & 2 deletions R/ard_categorical_ci.R
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ ard_categorical_ci.data.frame <- function(data,

# return empty ARD if no variables selected ----------------------------------
if (is_empty(variables)) {
return(dplyr::tibble() |> cards::as_card())
return(dplyr::tibble() |> cards::as_card(check = FALSE))
}

# calculate confidence intervals ---------------------------------------------
Expand Down Expand Up @@ -148,7 +148,7 @@ ard_categorical_ci.data.frame <- function(data,
dplyr::mutate(
context = "proportion_ci"
) |>
cards::as_card() |>
cards::as_card(check = FALSE) |>
cards::tidy_ard_column_order() |>
cards::tidy_ard_row_order()
}
Expand Down
4 changes: 2 additions & 2 deletions R/ard_categorical_ci.survey.design.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ ard_categorical_ci.survey.design <- function(data,

# return empty ARD if no variables selected ----------------------------------
if (is_empty(variables)) {
return(dplyr::tibble() |> cards::as_card())
return(dplyr::tibble() |> cards::as_card(check = FALSE))
}

# calculate and return ARD of one sample CI ----------------------------------
Expand Down Expand Up @@ -144,7 +144,7 @@ ard_categorical_ci.survey.design <- function(data,
stat_label = .data$stat_name,
fmt_fun = map(.data$stat, ~ case_switch(is.numeric(.x) ~ 2L, .default = as.character))
) |>
cards::as_card() |>
cards::as_card(check = FALSE) |>
cards::tidy_ard_column_order() |>
.restore_original_column_types(data = data$variables)

Expand Down
7 changes: 3 additions & 4 deletions R/ard_continuous.survey.design.R
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ ard_summary.survey.design <- function(data, variables, by = NULL,

# return empty ARD if no variables selected ----------------------------------
if (is_empty(variables)) {
return(dplyr::tibble() |> cards::as_card())
return(dplyr::tibble() |> cards::as_card(check = FALSE))
}

# compute the weighted statistics --------------------------------------------
Expand Down Expand Up @@ -161,7 +161,7 @@ ard_summary.survey.design <- function(data, variables, by = NULL,
# add class and return ARD object --------------------------------------------
df_stats |>
dplyr::mutate(context = "continuous") |>
cards::as_card() |>
cards::as_card(check = FALSE) |>
cards::tidy_ard_column_order()
}

Expand Down Expand Up @@ -192,7 +192,6 @@ accepted_svy_stats <- function(expand_quantiles = TRUE) {
}



# this function calculates the summary for a single variable, single statistic
# and for all `by` levels. it returns an ARD data frame
.compute_svy_stat <- function(data, variable, by = NULL, stat_name) {
Expand Down Expand Up @@ -427,7 +426,7 @@ accepted_svy_stats <- function(expand_quantiles = TRUE) {
tidyr::unnest(cols = "..ard_data...") |>
dplyr::arrange(.data$...ard_id_for_sorting...) |>
dplyr::select(-"...ard_id_for_sorting...") |>
cards::as_card()
cards::as_card(check = FALSE)
)
}

Expand Down
2 changes: 1 addition & 1 deletion R/ard_continuous_ci.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ ard_continuous_ci.data.frame <- function(data, variables, by = dplyr::group_vars

# return empty ARD if no variables selected ----------------------------------
if (is_empty(variables)) {
return(dplyr::tibble() |> cards::as_card())
return(dplyr::tibble() |> cards::as_card(check = FALSE))
}

# calculate CIs --------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions R/ard_continuous_ci.survey.design.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ ard_continuous_ci.survey.design <- function(data,

# return empty ARD if no variables selected ----------------------------------
if (is_empty(variables)) {
return(dplyr::tibble() |> cards::as_card())
return(dplyr::tibble() |> cards::as_card(check = FALSE))
}

# calculate and return ARD of one sample CI ----------------------------------
Expand Down Expand Up @@ -146,7 +146,7 @@ ard_continuous_ci.survey.design <- function(data,
stat_label = .data$stat_name,
fmt_fun = map(.data$stat, ~ case_switch(is.numeric(.x) ~ 2L, .default = as.character))
) |>
cards::as_card() |>
cards::as_card(check = FALSE) |>
cards::tidy_ard_column_order()
}

Expand Down
6 changes: 3 additions & 3 deletions R/ard_effectsize_cohens_d.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ ard_effectsize_cohens_d <- function(data, by, variables, conf.level = 0.95, ...)

# return empty ARD if no variables selected ----------------------------------
if (is_empty(variables)) {
return(dplyr::tibble() |> cards::as_card())
return(dplyr::tibble() |> cards::as_card(check = FALSE))
}

# build ARD ------------------------------------------------------------------
Expand Down Expand Up @@ -119,7 +119,7 @@ ard_effectsize_paired_cohens_d <- function(data, by, variables, id, conf.level =

# return empty ARD if no variables selected ----------------------------------
if (is_empty(variables)) {
return(dplyr::tibble() |> cards::as_card())
return(dplyr::tibble() |> cards::as_card(check = FALSE))
}

# build ARD ------------------------------------------------------------------
Expand Down Expand Up @@ -207,6 +207,6 @@ ard_effectsize_paired_cohens_d <- function(data, by, variables, id, conf.level =
by = "stat_name"
) |>
dplyr::mutate(stat_label = dplyr::coalesce(.data$stat_label, .data$stat_name)) |>
cards::as_card() |>
cards::as_card(check = FALSE) |>
cards::tidy_ard_column_order()
}
6 changes: 3 additions & 3 deletions R/ard_effectsize_hedges_g.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ ard_effectsize_hedges_g <- function(data, by, variables, conf.level = 0.95, ...)

# return empty ARD if no variables selected ----------------------------------
if (is_empty(variables)) {
return(dplyr::tibble() |> cards::as_card())
return(dplyr::tibble() |> cards::as_card(check = FALSE))
}

# build ARD ------------------------------------------------------------------
Expand Down Expand Up @@ -117,7 +117,7 @@ ard_effectsize_paired_hedges_g <- function(data, by, variables, id, conf.level =

# return empty ARD if no variables selected ----------------------------------
if (is_empty(variables)) {
return(dplyr::tibble() |> cards::as_card())
return(dplyr::tibble() |> cards::as_card(check = FALSE))
}

# build ARD ------------------------------------------------------------------
Expand Down Expand Up @@ -190,6 +190,6 @@ ard_effectsize_paired_hedges_g <- function(data, by, variables, id, conf.level =
by = "stat_name"
) |>
dplyr::mutate(stat_label = dplyr::coalesce(.data$stat_label, .data$stat_name)) |>
cards::as_card() |>
cards::as_card(check = FALSE) |>
cards::tidy_ard_column_order()
}
2 changes: 1 addition & 1 deletion R/ard_emmeans_contrast.R
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ ard_emmeans_contrast <- function(data, formula, method,
context = "emmeans_contrast",
) |>
dplyr::filter(.data$stat_name != "variable_level") |>
cards::as_card() |>
cards::as_card(check = FALSE) |>
cards::tidy_ard_column_order() |>
cards::tidy_ard_row_order()
}
Expand Down
2 changes: 1 addition & 1 deletion R/ard_emmeans_emmeans.R
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ ard_emmeans_emmeans <- function(data,
dplyr::filter(!is.na(.data$stat)) |>
dplyr::filter(.data$stat_name != "variable_level") |>
dplyr::arrange(.data$variable_level) |>
cards::as_card() |>
cards::as_card(check = FALSE) |>
cards::tidy_ard_column_order() |>
cards::tidy_ard_row_order()
}
Expand Down
2 changes: 1 addition & 1 deletion R/ard_incidence_rate.R
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ ard_incidence_rate <- function(data,
stat_label = dplyr::coalesce(.data$stat_label, .data$stat_name),
context = "incidence_rate",
) |>
cards::as_card() |>
cards::as_card(check = FALSE) |>
cards::tidy_ard_column_order() |>
cards::tidy_ard_row_order()
}
Expand Down
4 changes: 2 additions & 2 deletions R/ard_missing.survey.design.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ ard_missing.survey.design <- function(data,

# return empty ARD if no variables selected ----------------------------------
if (is_empty(variables)) {
return(dplyr::tibble() |> cards::as_card())
return(dplyr::tibble() |> cards::as_card(check = FALSE))
}

# convert all variables to T/F whether it's missing --------------------------
Expand Down Expand Up @@ -145,6 +145,6 @@ ard_missing.survey.design <- function(data,
# return final object --------------------------------------------------------
result |>
dplyr::mutate(context = "missing") |>
cards::as_card() |>
cards::as_card(check = FALSE) |>
cards::tidy_ard_column_order()
}
2 changes: 1 addition & 1 deletion R/ard_regression.R
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ ard_regression.data.frame <- function(x, formula, method, method.args = list(),
by = "stat_name"
) |>
dplyr::mutate(stat_label = dplyr::coalesce(.data$stat_label, .data$stat_name)) |>
cards::as_card() |>
cards::as_card(check = FALSE) |>
cards::tidy_ard_column_order()
}

Expand Down
4 changes: 2 additions & 2 deletions R/ard_smd_smd.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ ard_smd_smd <- function(data, by, variables, std.error = TRUE, conf.level = 0.95

# return empty ARD if no variables selected ----------------------------------
if (is_empty(variables)) {
return(dplyr::tibble() |> cards::as_card())
return(dplyr::tibble() |> cards::as_card(check = FALSE))
}

# build ARD ------------------------------------------------------------------
Expand Down Expand Up @@ -119,6 +119,6 @@ ard_smd_smd <- function(data, by, variables, std.error = TRUE, conf.level = 0.95
by = "stat_name"
) |>
dplyr::mutate(stat_label = dplyr::coalesce(.data$stat_label, .data$stat_name)) |>
cards::as_card() |>
cards::as_card(check = FALSE) |>
cards::tidy_ard_column_order()
}
2 changes: 1 addition & 1 deletion R/ard_stats_anova.R
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,6 @@ ard_stats_anova.data.frame <- function(x,
.default = .data$stat_name
)
) |>
cards::as_card() |>
cards::as_card(check = FALSE) |>
cards::tidy_ard_column_order()
}
2 changes: 1 addition & 1 deletion R/ard_stats_aov.R
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@ ard_stats_aov <- function(formula, data, ...) {
warning = aov["warning"],
error = aov["error"]
) |>
cards::as_card() |>
cards::as_card(check = FALSE) |>
cards::tidy_ard_column_order()
}
4 changes: 2 additions & 2 deletions R/ard_stats_chisq_test.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ ard_stats_chisq_test <- function(data, by, variables, ...) {

# return empty ARD if no variables selected ----------------------------------
if (is_empty(variables)) {
return(dplyr::tibble() |> cards::as_card())
return(dplyr::tibble() |> cards::as_card(check = FALSE))
}

# build ARD ------------------------------------------------------------------
Expand Down Expand Up @@ -69,5 +69,5 @@ ard_stats_chisq_test <- function(data, by, variables, ...) {
}
) |>
dplyr::bind_rows() |>
cards::as_card()
cards::as_card(check = FALSE)
}
4 changes: 2 additions & 2 deletions R/ard_stats_fisher_test.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ ard_stats_fisher_test <- function(data, by, variables, conf.level = 0.95, ...) {

# return empty ARD if no variables selected ----------------------------------
if (is_empty(variables)) {
return(dplyr::tibble() |> cards::as_card())
return(dplyr::tibble() |> cards::as_card(check = FALSE))
}

# build ARD ------------------------------------------------------------------
Expand Down Expand Up @@ -74,5 +74,5 @@ ard_stats_fisher_test <- function(data, by, variables, conf.level = 0.95, ...) {
}
) |>
dplyr::bind_rows() |>
cards::as_card()
cards::as_card(check = FALSE)
}
4 changes: 2 additions & 2 deletions R/ard_stats_kruskal_test.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ ard_stats_kruskal_test <- function(data, by, variables) {

# return empty ARD if no variables selected ----------------------------------
if (is_empty(variables)) {
return(dplyr::tibble() |> cards::as_card())
return(dplyr::tibble() |> cards::as_card(check = FALSE))
}

# build ARD ------------------------------------------------------------------
Expand Down Expand Up @@ -64,5 +64,5 @@ ard_stats_kruskal_test <- function(data, by, variables) {
}
) |>
dplyr::bind_rows() |>
cards::as_card()
cards::as_card(check = FALSE)
}
4 changes: 2 additions & 2 deletions R/ard_stats_mantelhaen_test.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ ard_stats_mantelhaen_test <- function(data, by, variables, strata, ...) {

# return empty ARD if no variables selected ----------------------------------
if (is_empty(variables)) {
return(dplyr::tibble() |> cards::as_card())
return(dplyr::tibble() |> cards::as_card(check = FALSE))
}

dots <- dots_list(...)
Expand All @@ -69,7 +69,7 @@ ard_stats_mantelhaen_test <- function(data, by, variables, strata, ...) {
stat_label = dplyr::coalesce(.data$stat_label, .data$stat_name),
context = "stats_mantelhaen_test",
) |>
cards::as_card() |>
cards::as_card(check = FALSE) |>
cards::tidy_ard_column_order() |>
cards::tidy_ard_row_order()
}
Expand Down
6 changes: 3 additions & 3 deletions R/ard_stats_mcnemar_test.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ ard_stats_mcnemar_test <- function(data, by, variables, ...) {

# return empty ARD if no variables selected ----------------------------------
if (is_empty(variables)) {
return(dplyr::tibble() |> cards::as_card())
return(dplyr::tibble() |> cards::as_card(check = FALSE))
}

# build ARD ------------------------------------------------------------------
Expand Down Expand Up @@ -103,7 +103,7 @@ ard_stats_mcnemar_test_long <- function(data, by, variables, id, ...) {

# return empty ARD if no variables selected ----------------------------------
if (is_empty(variables)) {
return(dplyr::tibble() |> cards::as_card())
return(dplyr::tibble() |> cards::as_card(check = FALSE))
}

# build ARD ------------------------------------------------------------------
Expand Down Expand Up @@ -169,7 +169,7 @@ ard_stats_mcnemar_test_long <- function(data, by, variables, id, ...) {
by = "stat_name"
) |>
dplyr::mutate(stat_label = dplyr::coalesce(.data$stat_label, .data$stat_name)) |>
cards::as_card() |>
cards::as_card(check = FALSE) |>
cards::tidy_ard_column_order()
}

Expand Down
4 changes: 2 additions & 2 deletions R/ard_stats_mood_test.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ ard_stats_mood_test <- function(data, by, variables, ...) {

# return empty ARD if no variables selected ----------------------------------
if (is_empty(variables)) {
return(dplyr::tibble() |> cards::as_card())
return(dplyr::tibble() |> cards::as_card(check = FALSE))
}

# build ARD ------------------------------------------------------------------
Expand Down Expand Up @@ -101,7 +101,7 @@ ard_stats_mood_test <- function(data, by, variables, ...) {
by = "stat_name"
) |>
dplyr::mutate(stat_label = dplyr::coalesce(.data$stat_label, .data$stat_name)) |>
cards::as_card() |>
cards::as_card(check = FALSE) |>
cards::tidy_ard_column_order()
}

Expand Down
Loading