Partial 'rmarkdown' Documents to Prettify your Reports

Use 'rmarkdown' partials, also know as child documents in 'knitr', so you can make components for HTML, PDF, and Word documents. The package provides various helper functions to make certain functions easier. You may want to use this package, if you want to flexibly summarise objects using a combination of figures, tables, text, and HTML widgets. Unlike HTML widgets, the output is Markdown and can hence be turn into other output formats than HTML. Currently does not play well with 'rmarkdown' notebooks, not tested with Quarto.


rmdpartials

Travis-CI BuildStatus codecov

Simplify using rmarkdown partials to document objects in R

Description

Ever want to make a standardized way to report a summary of something like a regression, but did not want to limit yourself to one unformatted block of text, one table, or one figure?

Rmarkdown partials allow you to define standardised knitr code chunks that become part of your rmarkdown report. They can then be turned into HTML, PDFs, or Word files. You could, for example, create an rmarkdown partial to summarise regression models in a flexible way.

You can also define your partials as methods of knit_print, so that a rich rmarkdown partial is made by default.

Documentation

Confer the help or: https://rubenarslan.github.io/rmdpartials/. See the vignette for a quick example of an HTML document generated with rmdpartials.

Install

To get the latest development version:

install.packages("remotes")
remotes::install_github("rubenarslan/rmdpartials")

Define a partial

Define a function like this:

my_summary <- function(object) {
  rmdpartials::partial("_my_summary.Rmd")
}

And create a file called _my_summary.Rmd with contents like this:

## My special summary

```{r}
summary(object)
```

## My special plot
```{r}
plot(object)
```

Usage

To use the partial in an rmarkdown report

```{r}
m1 <- lm(y ~ x, data = data)
my_summary(m1)
```

Usage as a knit_print method

To make your partial the default printing option for objects of a certain class when they are echoed in a knitr document, give it the name of a knit_print method.

knit_print.lm <- function(object) {
  rmdpartials::partial("_my_summary.Rmd")
}

Now, all you need to is let the lm object be echoed.

```{r}
m1 <- lm(y ~ x, data = data)
m1
```

You can also preview what the result from the partial would look like by calling it in an interactive session.

Code of conduct for contributing

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("rmdpartials")

0.6.5 by Ruben Arslan, 8 months ago


https://github.com/rubenarslan/rmdpartials, https://rubenarslan.github.io/rmdpartials/


Report a bug at https://github.com/rubenarslan/rmdpartials/issues


Browse source code at https://github.com/cran/rmdpartials


Authors: Ruben Arslan [aut, cre] , Gjalt-Jorn Peters [aut, ctb]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports stats, digest, utils, knitr, rlang

Suggests grDevices, graphics, testthat, rmarkdown, covr, dplyr, DT, ggplot2, pkgdown, spelling


Imported by codebook.


See at CRAN