Skip to content

Commit

Permalink
Merge branch 'main' into 240_ard_event_rates@main
Browse files Browse the repository at this point in the history
  • Loading branch information
ddsjoberg authored Jan 9, 2025
2 parents 0bd60b5 + ed0934e commit 21040aa
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 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.2.2.9009
Version: 0.2.2.9010
Authors@R: c(
person("Daniel D.", "Sjoberg", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-0862-2018")),
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# cardx 0.2.2.9009
# cardx 0.2.2.9010

* Update in `ard_categorical.survey.design()` for factor variables that are all missing. These variables can now be tabulated, where previously this resulted in an error.

Expand Down
4 changes: 2 additions & 2 deletions R/ard_categorical_ci.R
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ ard_categorical_ci.data.frame <- function(data,
}


df_grouping_cols <- cards::nest_for_ard(data, by = all_of(by), include_data = FALSE)
df_grouping_cols <- cards::nest_for_ard(data, by = by, include_data = FALSE)
levels <- .levels_for_row(data = data, by = by)

cards::nest_for_ard(
Expand Down Expand Up @@ -360,7 +360,7 @@ ard_categorical_ci.data.frame <- function(data,
conf.level, strata, weights, max.iterations) {
# create the base of what the grouping and variable ARD will look like
df_groups_variable <-
cards::nest_for_ard(data, by = all_of(c(by, variable)), include_data = FALSE) |>
cards::nest_for_ard(data, by = c(by, variable), include_data = FALSE) |>
dplyr::rename(
variable = glue::glue("group{length(c(variable, by))}"),
variable_level = glue::glue("group{length(c(variable, by))}_level")
Expand Down
7 changes: 4 additions & 3 deletions R/ard_survival_survfit.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
#' lung |>
#' ard_survival_survfit(y = Surv(time, status), variables = "sex", time = 500)
#' ```
#' You **cannot**, however, pass a stored formula, e.g. `survfit(my_formula, lung)`
#' You **cannot**, however, pass a stored formula, e.g. `survfit(my_formula, lung)`,
#' but you can use stored formulas with `rlang::inject(survfit(!!my_formula, lung))`.
#'
#' @section Variable Classes:
#' When the `survfit` method is called, the class of the stratifying variables
Expand Down Expand Up @@ -117,7 +118,7 @@ ard_survival_survfit.survfit <- function(x, times = NULL, probs = NULL, type = N
cli::cli_abort(
message = paste(
"The call in the survfit object {.arg x} must be an evaluated formula.",
"Please see the function documentation for details on properly specifying formulas."
"Please see {.help [{.fun ard_survival_survfit}](cardx::ard_survival_survfit)} documentation for details on properly specifying formulas."
),
call = get_cli_abort_call()
)
Expand Down Expand Up @@ -328,7 +329,7 @@ ard_survival_survfit.data.frame <- function(x, y, variables,
extract_multi_strata <- function(x, df_stat) {
x_terms <- attr(stats::terms(stats::as.formula(x$call$formula)), "term.labels")
x_terms <- gsub(".*\\(", "", gsub("\\)", "", x_terms))
if (length(x_terms) > 1) {
if (length(x_terms) > 0L) {
strata_lvls <- data.frame()

for (i in df_stat[["strata"]]) {
Expand Down
3 changes: 2 additions & 1 deletion man/ard_survival_survfit.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/testthat.R
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
library(testthat)
test_check("cardx")
test_check("cardx", stop_on_warning = TRUE)
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/ard_survival_survfit.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@
ard_survival_survfit(x, times = 25)
Condition
Error in `ard_survival_survfit()`:
! The call in the survfit object `x` must be an evaluated formula. Please see the function documentation for details on properly specifying formulas.
! The call in the survfit object `x` must be an evaluated formula. Please see `ard_survival_survfit()` (`?cardx::ard_survival_survfit()`) documentation for details on properly specifying formulas.

---

Expand Down

0 comments on commit 21040aa

Please sign in to comment.