Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

write2specific

write2word, write2html, write2pdf


Description

Functions to output tables to a single Word, HTML, or PDF document.

Usage

write2word(object, file, ...)

write2pdf(object, file, ...)

write2html(object, file, ...)

Arguments

object

An object.

file

A single character string denoting the filename for the output document.

...

Additional arguments to be passed to FUN, rmarkdown::render, etc. One popular option is to use quiet = TRUE to suppress the command line output.

Details

To generate the appropriate file type, the write2* functions use one of rmarkdown::word_document, rmarkdown::html_document, and rmarkdown::pdf_document to get the job done. "..." arguments are passed to these functions, too.

Value

object is returned invisibly, and file is written.

Author(s)

Ethan Heinzen, adapted from code from Krista Goergen

See Also

Examples

## Not run: 
data(mockstudy)
# tableby example
tab1 <- tableby(arm ~ sex + age, data=mockstudy)
write2html(tab1, "~/trash.html")

# freqlist example
tab.ex <- table(mockstudy[, c("arm", "sex", "mdquality.s")], useNA = "ifany")
noby <- freqlist(tab.ex, na.options = "include")
write2pdf(noby, "~/trash2.pdf")

# A more complicated example
write2word(tab1, "~/trash.doc",
  keep.md = TRUE,
  reference_docx = mystyles.docx, # passed to rmarkdown::word_document
  quiet = TRUE, # passed to rmarkdown::render
  title = "My cool new title") # passed to summary.tableby

## End(Not run)

arsenal

An Arsenal of 'R' Functions for Large-Scale Statistical Summaries

v3.6.2
GPL (>= 2)
Authors
Ethan Heinzen [aut, cre], Jason Sinnwell [aut], Elizabeth Atkinson [aut], Tina Gunderson [aut], Gregory Dougherty [aut], Patrick Votruba [ctb], Ryan Lennon [ctb], Andrew Hanson [ctb], Krista Goergen [ctb], Emily Lundt [ctb], Brendan Broderick [ctb], Maddie McCullough [art]
Initial release
2021-02-16

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.