Travis-CI Build
Status codecov

Simplify using rmarkdown partials to document objects in R


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.


Confer the help or: See the vignette for a quick example of an HTML document generated with rmdpartials.


To get the latest development version:


Define a partial

Define a function like this:

my_summary <- function(object) {

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

## My special summary


## My special plot


To use the partial in an rmarkdown report

m1 <- lm(y ~ x, data = data)

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) {

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

m1 <- lm(y ~ x, data = data)

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

Try the rmdpartials package in your browser

Any scripts or data that you put into this service are public.

rmdpartials documentation built on July 2, 2020, 3:22 a.m.