Skip to content

Commit

Permalink
Merge branch 'main' into 108-construct_model
Browse files Browse the repository at this point in the history
  • Loading branch information
ddsjoberg authored Apr 16, 2024
2 parents 3965c84 + c3edc88 commit 882c6b7
Show file tree
Hide file tree
Showing 51 changed files with 474 additions and 196 deletions.
2 changes: 2 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Pre-review Checklist (if item does not apply, mark is as complete)
- [ ] PR branch has pulled the most recent updates from master branch: `usethis::pr_merge_main()`
- [ ] If a bug was fixed, a unit test was added.
- [ ] If a new `ard_*()` function was added, it passes the ARD structural checks from `cards::check_ard_structure()`.
- [ ] If a new `ard_*()` function was added, `set_cli_abort_call()` has been set.
- [ ] If a new `ard_*()` function was added and it depends on another package (such as, `broom`), `is_pkg_installed("broom", reference_pkg = "cardx")` has been set in the function call and the following added to the roxygen comments: `@examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom"", reference_pkg = "cardx"))`
- [ ] Code coverage is suitable for any new functions/features (generally, 100% coverage for new code): `devtools::test_coverage()`

Reviewer Checklist (if item does not apply, mark is as complete)
Expand Down
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: cardx
Title: Extra Analysis Results Data Utilities
Version: 0.1.0.9015
Version: 0.1.0.9019
Authors@R: c(
person("Daniel", "Sjoberg", , "[email protected]", role = c("aut", "cre")),
person("Abinaya", "Yogasekaram", , "[email protected]", role = "aut"),
Expand Down Expand Up @@ -31,6 +31,7 @@ Suggests:
car (>= 3.0-11),
effectsize (>= 0.6.0),
geepack (>= 1.3.2),
ggsurvfit (>= 1.0.0),
lme4 (>= 1.1-31),
parameters (>= 0.20.2),
smd (>= 0.6.6),
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export(ard_survey_svychisq)
export(ard_survey_svycontinuous)
export(ard_survey_svyranktest)
export(ard_survey_svyttest)
export(ard_survival_survdiff)
export(ard_survival_survfit)
export(bt)
export(bt_strip)
Expand Down
5 changes: 3 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# cardx 0.1.0.9015
# cardx 0.1.0.9019

### Breaking Changes

Expand Down Expand Up @@ -39,8 +39,9 @@ ard_moodtest() -> ard_stats_mood_test()

* Updated `ard_stats_t_test()` and `ard_stats_wilcox_test()` to no longer require the `by` argument, which yields central estimates with their confidence intervals. (#82)

* Import cli call environment functions from `https://github.com/ddsjoberg/standalone/blob/main/R/standalone-cli_call_env.R` and implement `set_cli_abort_call` in user-facing functions. (#111, @edelarua)
* Imported cli call environment functions from `https://github.com/ddsjoberg/standalone/blob/main/R/standalone-cli_call_env.R` and implemented `set_cli_abort_call` in user-facing functions. (#111)

* Added `ard_survival_survdiff()` for creating results from `survival::survdiff()`. (#113)

# cardx 0.1.0

Expand Down
2 changes: 0 additions & 2 deletions R/ard_aod_wald_test.R
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,10 @@ ard_aod_wald_test <- function(x, ...) {

#' Extract data from wald.test object
#'
#'
#' @param wald_test (`data.frame`)\cr wald test object object from `aod::wald.test()`
#'
#' @return a data frame containing the wald test results.
#' @keywords internal

.extract_wald_results <- function(wald_test) {
df <- wald_test$result$chi2[("df")]
statistic <- wald_test$result$chi2[("chi2")]
Expand Down
2 changes: 1 addition & 1 deletion R/ard_car_vif.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ ard_car_vif <- function(x, ...) {
values_to = "stat"
) |>
dplyr::mutate(
context = "vif",
context = "car_vif",
stat_label = ifelse(
.data$stat_name == "aGVIF",
"Adjusted GVIF",
Expand Down
4 changes: 2 additions & 2 deletions R/ard_effectsize_cohens_d.R
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ ard_effectsize_paired_cohens_d <- function(data, by, variables, id, ...) {
#'
#' @return ARD data frame
#' @keywords internal
#' @examples
#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("effectsize", "parameters"), reference_pkg = "cardx"))
#' cardx:::.format_cohens_d_results(
#' by = "ARM",
#' variable = "AGE",
Expand All @@ -181,7 +181,7 @@ ard_effectsize_paired_cohens_d <- function(data, by, variables, id, ...) {
fun_args_to_record = c("mu", "paired", "pooled_sd", "alternative"),
formals = formals(asNamespace("effectsize")[["cohens_d"]]),
passed_args = c(list(paired = paired), dots_list(...)),
lst_ard_columns = list(group1 = by, variable = variable, context = "cohens_d")
lst_ard_columns = list(group1 = by, variable = variable, context = "effectsize_cohens_d")
)

# add the stat label ---------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions R/ard_effectsize_hedges_g.R
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ ard_effectsize_paired_hedges_g <- function(data, by, variables, id, ...) {
#'
#' @return ARD data frame
#' @keywords internal
#' @examples
#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("effectsize", "parameters"), reference_pkg = "cardx"))
#' cardx:::.format_hedges_g_results(
#' by = "ARM",
#' variable = "AGE",
Expand All @@ -173,7 +173,7 @@ ard_effectsize_paired_hedges_g <- function(data, by, variables, id, ...) {
fun_args_to_record = c("mu", "paired", "pooled_sd", "alternative"),
formals = formals(asNamespace("effectsize")[["hedges_g"]]),
passed_args = c(list(paired = paired), dots_list(...)),
lst_ard_columns = list(group1 = by, variable = variable, context = "hedges_g")
lst_ard_columns = list(group1 = by, variable = variable, context = "effectsize_hedges_g")
)

# add the stat label ---------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion R/ard_smd_smd.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ ard_smd_smd <- function(data, by, variables, ...) {
formals = formals(smd::smd)["gref"],
# removing the `std.error` ARGUMENT (not the result)
passed_args = dots_list(...) |> utils::modifyList(list(std.error = NULL)),
lst_ard_columns = list(group1 = by, variable = variable, context = "smd")
lst_ard_columns = list(group1 = by, variable = variable, context = "smd_smd")
)

# add the stat label ---------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion R/ard_stats_aov.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ ard_stats_aov <- function(formula, data, ...) {
.data$stat_name %in% "meansq" ~ "Mean of Sum of Squares",
TRUE ~ .data$stat_name
),
context = "aov",
context = "stats_aov",
warning = aov["warning"],
error = aov["error"]
) |>
Expand Down
2 changes: 1 addition & 1 deletion R/ard_stats_chisq_test.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ ard_stats_chisq_test <- function(data, by, variables, ...) {
c("correct", "p", "rescale.p", "simulate.p.value", "B"),
formals = formals(stats::chisq.test),
passed_args = dots_list(...),
lst_ard_columns = list(group1 = by, variable = variable, context = "chisqtest")
lst_ard_columns = list(group1 = by, variable = variable, context = "stats_chisq_test")
) |>
dplyr::mutate(
.after = "stat_name",
Expand Down
2 changes: 1 addition & 1 deletion R/ard_stats_fisher_test.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ ard_stats_fisher_test <- function(data, by, variables, ...) {
),
formals = formals(stats::fisher.test),
passed_args = dots_list(...),
lst_ard_columns = list(group1 = by, variable = variable, context = "fishertest")
lst_ard_columns = list(group1 = by, variable = variable, context = "stats_fisher_test")
) |>
dplyr::mutate(
.after = "stat_name",
Expand Down
2 changes: 1 addition & 1 deletion R/ard_stats_kruskal_test.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ ard_stats_kruskal_test <- function(data, by, variables) {
broom::tidy()
),
tidy_result_names = c("statistic", "p.value", "parameter", "method"),
lst_ard_columns = list(group1 = by, variable = variable, context = "kruskaltest")
lst_ard_columns = list(group1 = by, variable = variable, context = "stats_kruskal_test")
) |>
dplyr::mutate(
.after = "stat_name",
Expand Down
4 changes: 2 additions & 2 deletions R/ard_stats_mcnemar_test.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ ard_stats_mcnemar_test <- function(data, by, variables, ...) {
#'
#' @return ARD data frame
#'
#' @examples
#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx"))
#' cardx:::.format_mcnemartest_results(
#' by = "ARM",
#' variable = "AGE",
Expand All @@ -92,7 +92,7 @@ ard_stats_mcnemar_test <- function(data, by, variables, ...) {
fun_args_to_record = c("correct"),
formals = formals(asNamespace("stats")[["mcnemar.test"]]),
passed_args = dots_list(...),
lst_ard_columns = list(group1 = by, variable = variable, context = "mcnemartest")
lst_ard_columns = list(group1 = by, variable = variable, context = "stats_mcnemar_test")
)

# add the stat label ---------------------------------------------------------
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 @@ -73,7 +73,7 @@ ard_stats_mood_test <- function(data, by, variables, ...) {
#'
#' @return ARD data frame
#' @keywords internal
#' @examples
#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx"))
#' cardx:::.format_moodtest_results(
#' by = "SEX",
#' variable = "AGE",
Expand All @@ -91,7 +91,7 @@ ard_stats_mood_test <- function(data, by, variables, ...) {
tidy_result_names = c("statistic", "p.value", "method", "alternative"),
formals = formals(asNamespace("stats")[["mood.test.default"]]),
passed_args = c(dots_list(...)),
lst_ard_columns = list(group1 = by, variable = variable, context = "moodtest")
lst_ard_columns = list(group1 = by, variable = variable, context = "stats_mood_test")
)

# add the stat label ---------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion R/ard_stats_oneway_test.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ ard_stats_oneway_test <- function(formula, data, ...) {
c("var.equal"),
formals = formals(stats::oneway.test),
passed_args = dots_list(...),
lst_ard_columns = list(context = "oneway.test")
lst_ard_columns = list(context = "stats_oneway_test")
) |>
dplyr::mutate(
.after = "stat_name",
Expand Down
2 changes: 1 addition & 1 deletion R/ard_stats_prop_test.R
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ ard_stats_prop_test <- function(data, by, variables, ...) {
fun_args_to_record = c("p", "conf.level", "correct"),
formals = formals(stats::prop.test),
passed_args = dots_list(...),
lst_ard_columns = list(group1 = by, variable = variable, context = "proptest")
lst_ard_columns = list(group1 = by, variable = variable, context = "stats_prop_test")
)

# add the stat label ---------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions R/ard_stats_t_test.R
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ ard_stats_paired_t_test <- function(data, by, variables, id, ...) {
#'
#' @return ARD data frame
#' @keywords internal
#' @examples
#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx"))
#' cardx:::.format_ttest_results(
#' by = "ARM",
#' variable = "AGE",
Expand All @@ -168,7 +168,7 @@ ard_stats_paired_t_test <- function(data, by, variables, id, ...) {
fun_args_to_record = c("mu", "paired", "var.equal", "conf.level"),
formals = formals(asNamespace("stats")[["t.test.default"]]),
passed_args = c(list(paired = paired), dots_list(...)),
lst_ard_columns = list(variable = variable, context = "ttest")
lst_ard_columns = list(variable = variable, context = "stats_t_test")
)

if (!is_empty(by)) {
Expand Down
4 changes: 2 additions & 2 deletions R/ard_stats_wilcox_test.R
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ ard_stats_paired_wilcox_test <- function(data, by, variables, id, ...) {
#'
#' @return ARD data frame
#'
#' @examples
#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx"))
#' # Pre-processing ADSL to have grouping factor (ARM here) with 2 levels
#' ADSL <- cards::ADSL |>
#' dplyr::filter(ARM %in% c("Placebo", "Xanomeline High Dose")) |>
Expand Down Expand Up @@ -178,7 +178,7 @@ ard_stats_paired_wilcox_test <- function(data, by, variables, id, ...) {
),
formals = formals(asNamespace("stats")[["wilcox.test.default"]]),
passed_args = c(list(paired = paired), dots_list(...)),
lst_ard_columns = list(variable = variable, context = "wilcoxtest")
lst_ard_columns = list(variable = variable, context = "stats_wilcox_test")
)

if (!is_empty(by)) {
Expand Down
2 changes: 1 addition & 1 deletion R/ard_survey_svychisq.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ ard_survey_svychisq <- function(data, by, variables, statistic = "F", ...) {
),
tidy_result_names = c("statistic", "p.value", "ndf", "ddf", "method"),
passed_args = dots_list(...),
lst_ard_columns = list(group1 = by, variable = variable, context = "svychisq")
lst_ard_columns = list(group1 = by, variable = variable, context = "survey_svychisq")
) |>
dplyr::mutate(
.after = "stat_name",
Expand Down
2 changes: 1 addition & 1 deletion R/ard_survey_svycontinuous.R
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ ard_survey_svycontinuous <- function(data, variables, by = NULL,

# add class and return ARD object --------------------------------------------
df_stats |>
dplyr::mutate(context = "continuous") |>
dplyr::mutate(context = "survey_svycontinuous") |>
cards::tidy_ard_column_order() %>%
{structure(., class = c("card", class(.)))} # styler: off
}
Expand Down
2 changes: 1 addition & 1 deletion R/ard_survey_svyranktest.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ ard_survey_svyranktest <- function(data, by, variables, test, ...) {
"method", "alternative"
),
passed_args = dots_list(...),
lst_ard_columns = list(group1 = by, variable = variable, context = "svyranktest")
lst_ard_columns = list(group1 = by, variable = variable, context = "survey_svyranktest")
)

# add the stat label ---------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion R/ard_survey_svyttest.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ ard_survey_svyttest <- function(data, by, variables, conf.level = 0.95, ...) {
"conf.level", "method", "alternative"
),
passed_args = dots_list(...),
lst_ard_columns = list(group1 = by, variable = variable, context = "svyttest")
lst_ard_columns = list(group1 = by, variable = variable, context = "survey_svyttest")
)

# add the stat label ---------------------------------------------------------
Expand Down
Loading

0 comments on commit 882c6b7

Please sign in to comment.