survexport: Export an R4VN Survival Analysis

View source: R/surv-export.R

survexportR Documentation

Export an R4VN Survival Analysis

Description

Passes all non-empty tables from tabsurv() to the existing tabexport() function. It is also called internally when tabsurv(export=, file=) is used, so a complete Word/Excel/HTML report can be requested in one command.

Usage

survexport(
  x,
  export = NULL,
  file = NULL,
  open = FALSE,
  title = NULL,
  sheet = NULL,
  overwrite = TRUE,
  quiet = FALSE
)

Arguments

x

An object returned by tabsurv().

export, file, open, title, sheet, overwrite, quiet

Passed to tabexport().

Value

The result returned by tabexport().

Examples

if (requireNamespace("survival", quietly = TRUE)) {
  d <- data.frame(time = c(5, 8, 10, 12, 15, 18),
                  event = c(1, 0, 1, 1, 0, 1),
                  group = factor(rep(c("A", "B"), 3)))
  s <- tabsurv(time, event, by = group, data = d, show = FALSE)
  # Export when a file is wanted, for example:
  # survexport(s, export = "xlsx", file = tempfile(fileext = ".xlsx"))
}

R4VN documentation built on Sept. 30, 2026, 5:13 p.m.