Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Helpers to make rmarkdown partials

License

NotificationsYou must be signed in to change notification settings

rubenarslan/rmdpartials

Repository files navigation

Travis-CI Build Statuscodecov

Simplify using rmarkdown partials to document objects in R

Description

Ever want to make a standardized way to report a summary of somethinglike a regression, but did not want to limit yourself to one unformattedblock of text, one table, or one figure?

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

You can also define your partials as methods ofknit_print, so that arich rmarkdown partial is made by default.

Documentation

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

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 acertain class when they are echoed in a knitr document, give it the nameof 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 bycalling it in an interactivesession.

About

Helpers to make rmarkdown partials

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp