Movatterモバイル変換


[0]ホーム

URL:


docoratordocorator logo

R-CMD-checkstatus: experimental

{docorator} is an engine for creating production displays from R.Specifically, {docorator} provides the following functionality:

The main function,as_docorator() accepts an R objectcontaining the display as input. For best results with sizing, the tableshould be prepared via {gt}, or packages that interface with {gt} suchas {tfrmt}, and the figure should be prepared with {ggplot2}.Alternatively, the path to a PNG can be passed to {docorator}.Specifically, thex should be one of the following:

Thedocorator object, which is saved by default, canthen be output using one or both of the following render functions whichcan be piped together:render_pdf() andrender_rtf()

Use

# install from GitHubdevtools::install_github("GSK-Biostatistics/docorator")# Load packagelibrary(docorator)# Create table (or figure)mytbl<- gt::exibble|>  gt::gt()# Export displaymytbl|>as_docorator(display_name ="mytbl",header =fancyhead(fancyrow(left ="My Study",center =NA,right =doc_pagenum()),fancyrow(left ="My Population",center =NA,right =NA),fancyrow(left =NA,center ="My Table",right =NA)    ),footer =fancyfoot(fancyrow(left ="mypath/mytbl.R",center =NA,right ="Data as of 2025-01-01")    )  )|>render_pdf()|>render_rtf()

Docorator example

Note

{docorator} requires LaTeX libraries for PDF rendering. If using{tinytex}, the “TinyTeX” bundle covers the core dependencies.


[8]ページ先頭

©2009-2025 Movatter.jp