- Notifications
You must be signed in to change notification settings - Fork0
Helpers to make rmarkdown partials
License
rubenarslan/rmdpartials
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Simplify using rmarkdown partials to document objects in R
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.
Confer the help or:https://rubenarslan.github.io/rmdpartials. See thevignettefor a quick example of an HTML document generated withrmdpartials.
To get the latest development version:
install.packages("remotes")remotes::install_github("rubenarslan/rmdpartials")
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)```To use the partial in an rmarkdown report
```{r}m1 <- lm(y ~ x, data = data)my_summary(m1)```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
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.