README.md

reportutils

The goal of reportutils is to provide utility functions that facilitate easier, faster and more reliable communication of data pre-processing and analysis.

Installation

You can install the development version of reportutils like so:

devtools::install_github("MiguelRodo/reportutils")

Uses

library(reportutils)

Display outputs by section with headings

The function loop_and display produces the following result, when using the knitr chunk option results = "asis":

example_tbl <- data.frame(
  x = rep(c("Female", "Male"), each = 2),
  y = rep(c("Child", "Adult"), 2),
  path_plot = paste0(here::here(), "/man/fig/p_", 1:4, ".png"),
  stringsAsFactors = FALSE
)
loop_and_display(
  .tbl = example_tbl,
  .vars = c("x", "y"), 
  .f = function(df) {
    #print(df)
    cat(paste0("![](", df$path_plot, ")"), "\n")
    #knitr::include_graphics(df$path_plot)
  }
)

Female

Adult

Child

Male

Adult

Child



MiguelRodo/reportutils documentation built on April 11, 2022, 3:32 p.m.