Skip to content

Commit

Permalink
Updated NEWS
Browse files Browse the repository at this point in the history
  • Loading branch information
ddsjoberg committed Oct 25, 2024
1 parent f5d4f35 commit df57767
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 35 deletions.
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# cardx 0.2.1.9008

* Implemented `summary(extend=TRUE)` in `ard_survival_survfit()` to return results for time points out of bounds. (#224)

* Added a `data.frame` method to `ard_survival_survfit()`.

* Added a warning for incorrect formula type to `ard_survival_survfit()`. (#223)

# cardx 0.2.1

## New Features and Updates
Expand Down
31 changes: 13 additions & 18 deletions R/ard_survival_survfit.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,28 +34,23 @@
#' @inheritParams rlang::args_dots_empty
#'
#' @section Formula Specification:
#' When passing a [`survival::survfit()`] object to `ard_survival_survfit()`,
#' the `survfit()` call must use an evaluated formula and not a stored formula.
#' Including a proper formula in the call allows the function to accurately
#' identify all variables included in the estimation. See below for examples:
#'
#' The `x` argument can accepts a [survival::survfit()] object, which must be created from a formula or previously
#' fitted model. In order to identify the underlying variable names when processing this formula, it must be supplied
#' directly to [survival::survfit()] rather and not taken from a variable. For example, `x` can be constructed and
#' supplied to `ard_survival_survfit()` as follows:
#' ```{r, eval = FALSE}
#' data <- mtcars
#' x <- survival::survfit(survival::Surv(mpg, am) ~ cyl, data = data)
#'
#' ard_survival_survfit(x, times = 25)
#' ```
#' ```r
#' library(cardx)
#' library(survival)
#'
#' Alternatively, a data frame can be passed as `x`, with the formula outcome supplied to `y` and stratification
#' variables passed to `variables`, and the formula will be constructed and passed to [survival::survfit()] within the
#' function.
#' ```{r, eval = FALSE}
#' x <- mtcars
#' y <- "survival::Surv(mpg, am)"
#' variables <- "cyl"
#' # include formula in `survfit()` call
#' survfit(Surv(time, status) ~ sex, lung) |> ard_survival_survfit(time = 500)
#'
#' ard_survival_survfit(x, y, variables, times = 25)
#' # you can also pass a data frame to `ard_survival_survfit()` as well.
#' 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)`
#'
#' @return an ARD data frame of class 'card'
#' @name ard_survival_survfit
Expand Down
29 changes: 12 additions & 17 deletions man/ard_survival_survfit.Rd

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

0 comments on commit df57767

Please sign in to comment.