tidy_summary {depigner}R Documentation

tidy_summary

Description

Converts a summary() object produced by Hmisc or by rms packages to a tidy data frame ready to be 'pander'ed (e.g. printed on a word document after knitting the source (with 'knitr').

Usage

tidy_summary(x, ..., digits = 3L)

## S3 method for class 'summary.formula.reverse'
tidy_summary(x, ..., digits = 3L)

## S3 method for class 'summary.rms'
tidy_summary(x, ..., digits = 3L)

Arguments

x

an object used to select a method, output of some summary by Hmisc.

...

further arguments passed to or from other methods

digits

number of significant digits to use (default 3L).

Value

a [tibble][tibble::tibble-package]

Methods (by class)

Note

The output is supposed to be used as input to [pander][pander::pander], and contains few otherwise messy characters included for an optimal (pander) formatting.

to see the options you can pass to ... for a custom print, see the print section in summary.formula.

Examples


  library(Hmisc)
  my_summary <- summary(Species ~ ., data = iris, method = "reverse")
  tidy_summary(my_summary)


  library(rms)
  options(datadist = "dd")
  n <- 1000L
  set.seed(731L)
  age <- 50L + 12L * rnorm(n)
  sex <- factor(sample(c("Male", "Female"), n,
    rep = TRUE,
    prob = c(.6, .4)
  ))
  cens <- 15L * runif(n)
  h <- .02 * exp(.04 * (age - 50L) + .8 * (sex == "Female"))
  dt <- -log(runif(n)) / h
  e <- ifelse(dt <= cens, 1L, 0L)
  dt <- pmin(dt, cens)

  dd <- datadist(age, sex)

  S <- survival::Surv(dt, e)
  f <- rms::cph(S ~ age + sex)


  my_summary <- summary(f)
  tidy_summary(my_summary)


[Package depigner version 0.9.1 Index]