tidy_summary: tidy_summary

Description Usage Arguments Value Methods (by class) Note Examples

Description

Converts a summary() object produced by Hmisc or by rms packages to a tidy data frame ready to be pandered (e.g. printed on a word document after knit the source.

Usage

1
2
3
4
5
6
7
tidy_summary(x, ...)

## S3 method for class 'summary.formula.reverse'
tidy_summary(x, ...)

## S3 method for class 'summary.rms'
tidy_summary(x, diff_digits = 2, ...)

Arguments

x

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

...

further arguments passed to or from other methods

diff_digits

number of significant digits to use (default 2) for the step-difference between continuous variable HR computation.

Value

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

Methods (by class)

Note

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
  library(Hmisc)
  my_summary <- summary(Species ~., data = iris, method = "reverse")
  tidy_summary(my_summary)
  library(rms)
  options(dd = "datadist")
  n <- 1000
  set.seed(731)
  age <- 50 + 12*rnorm(n)
  sex <- factor(sample(c('Male','Female'), n,
      rep  = TRUE,
      prob = c(.6, .4)
  ))
  cens <- 15*runif(n)
  h <- .02*exp(.04*(age - 50) + .8*(sex == 'Female'))
  dt <- -log(runif(n))/h
  e <- ifelse(dt <= cens, 1, 0)
  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)

CorradoLanera/depigner documentation built on June 1, 2019, 9:12 p.m.