Learn R Programming

nlmixr2rpt

Templated Word and PowerPoint reporting for nlmixr2

Overview

The purpose of this package is to automate the reporting of analyses performed in the nlmixr2 package in both PowerPoint and Word. This is accomplished with a yaml file that contains specifications for report elements (figures and tables) as well as the contents of Word and PowerPoint documents. Internal templates for both the documents and the report yaml file are included. These can be customized: The format of the document templates can be customized for your organization by using the onbrand package. The report contents can be customized by creating a copy of the included yaml file and modifying it to suite your needs (see the vignette below).

Installation

To install off of CRAN:

install.packages("nlmixr2rpt", dependencies = TRUE)

To install the development version from GitHub

#install.packages("devtools") 
devtools::install_github("nlmixr2/nlmixr2rpt", dependencies=TRUE)

Getting Started

PowerPoint

Assuming you have the results of an nlmixr analysis in the object fit you can dump those results into a PowerPoint document by doing the following:

obnd_pptx = read_template(
  template = system.file(package="nlmixr2rpt", "templates","nlmixr_obnd_template.pptx"),
  mapping  = system.file(package="nlmixr2rpt", "templates","nlmixr_obnd_template.yaml"))

obnd_pptx = report_fit(
  fit     = fit, 
  obnd    = obnd_pptx)

save_report(obnd_pptx, "report.pptx")

This creates an onbrand reporting object obnd_pptx. You can add other reporting elements using onbrand or officer. Next the command report_fit() will append the results in the fit object to an onbrand report. After calling report_fit() you can append other reporting elements. Finally you just need to save the document using save_report().

Word

The process for a Word document is the same. You simply need to use a Word onbrand template instead of a PowerPoint.

obnd_docx = read_template(
  template = system.file(package="nlmixr2rpt", "templates","nlmixr_obnd_template.docx"),
  mapping  = system.file(package="nlmixr2rpt", "templates","nlmixr_obnd_template.yaml"))

obnd_docx = report_fit(
  fit     = fit, 
  obnd    = obnd_docx)

save_report(obnd_docx, "report.docx")

Further reading

If you want to learn more about customizing the outputs or using your own organizational templates in reporting, be sure to browse through the documentation and check out the vignettes:

Copy Link

Version

Install

install.packages('nlmixr2rpt')

Monthly Downloads

314

Version

0.2.2

License

GPL (>= 3)

Maintainer

John Harrold

Last Published

October 11th, 2025

Functions in nlmixr2rpt (0.2.2)

eval_str

Evaluate R Code in String
yaml_read_fit

Reads and Checks report_fit.yaml File
write_figure

Writes Figures to File
safe_text

Escapes Curly Braces for cli functions
report_fit

Report nlmixr2 Fit Results to PowerPoint and Word
mk_error_tab

Generates a flextable Object with Error Message
build_tables

Generates Tables for an nlmixr2 Report
mk_error_fig

Generates ggplot Object with Error Message
process_ph

Substitutes Placehodlers in Strings
build_figures

Generates Figures for an nlmixr2 Report
gen_pest_table

Makes nlmixr2 Parameter Estimate Table for Reporting
fetch_fdim

Gets Figure Dimensions
fetch_option

Fetch Analysis Options
fetch_fit_example

Fetch Fit Example