-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
executable file
·123 lines (85 loc) · 4.71 KB
/
README.Rmd
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
library(onbrand)
library(nlmixr2rpt)
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
fit = fetch_fit_example()
```
# nlmixr2rpt <img src="man/figures/nlmixr2rpt_hex.png" align="right" width="138.5" />
<!-- badges: start -->
[![R-CMD-check](https://github.com/nlmixr2/nlmixr2rpt/workflows/R-CMD-check/badge.svg)](https://github.com/nlmixr2/nlmixr2rpt/actions)
[![CRAN checks](https://badges.cranchecks.info/worst/nlmixr2rpt.svg)](https://cran.r-project.org/web/checks/check_results_nlmixr2rpt.html)
[![version](https://www.r-pkg.org/badges/version/nlmixr2rpt)](https://CRAN.R-project.org/package=nlmixr2rpt)
![cranlogs](https://cranlogs.r-pkg.org/badges/nlmixr2rpt)
![Active](https://www.repostatus.org/badges/latest/active.svg)
[![Lifecycle: Experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html)
<!---
-->
<!-- badges: end -->
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](https://cran.r-project.org/package=nlmixr2rpt):
```r
install.packages("nlmixr2rpt", dependencies = TRUE)
```
To install the development version from [GitHub](https://github.com/nlmixr2/nlmixr2rpt/)
```r
#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:
```{r, eval=FALSE, echo=TRUE}
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")
```
```{r, eval=TRUE, echo=FALSE, message=FALSE, results=FALSE}
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, file.path(tempdir(), "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.
```{r, eval=FALSE, echo=TRUE}
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")
```
```{r, eval=TRUE, echo=FALSE, message=FALSE, results=FALSE}
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, file.path(tempdir(), "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](https://nlmixr2.github.io/nlmixr2rpt/) and check out the vignettes:
* [Reporting nlmixr Fit Results](https://nlmixr2.github.io/nlmixr2rpt/articles/Reporting_nlmixr_Fit_Results.html)
* [Accessing Figures and Tables](https://nlmixr2.github.io/nlmixr2rpt/articles/Accessing_Figures_and_Tables.html)