MyNixOS website logo
Description

Lightweight Infrastructure for Handling Multiple R Markdown Documents.

Provides an infrastructure for handling multiple R Markdown reports, including automated curation and time-stamping of outputs, parameterisation and provision of helper functions to manage dependencies.

Codecov testcoverage R-CMD-check

Welcome to reportfactory!


NOT&/span;

This version of {reportfactory} works in a very different way to the previous unreleased version. For those already using {reportfactory} in their pipelines you can obtain the old version using the {remotes} package:

remotes::install_github("reconverse/reportfactory@old_version")

You can also download it directly from https://github.com/reconverse/reportfactory/releases/tag/old_version.

You can install the current version of the package from CRAN with:

install.packages("reportfactory")

The development version can be installed from GitHub with:

if (!require(remotes)) {
  install.packages("remotes")
}
remotes::install_github("reconverse/reportfactory", build_vignettes = TRUE)

reportfactory in a nutshell

{reportfactory} is a R package which facilitates workflows for handling multiple .Rmd reports, compiling one or several reports in one go, and storing outputs in well-organised, timestamped folders. This is illustrated in the figure below:


workflow

There a few key principles it adheres to:

  • Simple: only focusses on the compilation of reports with minimum overhead for the user.

  • Non-invasive: .Rmd documents need no alteration to work within the factory.

  • Reproducible: time-stamped folder structure and customisable subfolders make viewing the same report over time a breeze; handling of package dependencies facilitates the deployment of factories on multiple computers.

  • Time-saving: easy compilation of multiple reports using regular expressions; book-keeping is handled by the factory and ensures that: i) every report is compiled in a clean environment and ii) all outputs are stored in a dedicated folder

Installing the package

To install the development version of the package, use:

remotes::install_github("reconverse/reportfactory")

Quick start

Step 1 - Create a new factory

Create and open a new factory. Here, we create the factory with the default settings. This will create the factory in our current working directory and then move us in to this new factory.

library(reportfactory)
new_factory("my_factory")

Step 2 - Add your reports

Here we’ve already created some with most of the default arguments being set to TRUE (the default). These default settings include both an example report and some associated data (report_sources/example_report.Rmd and data/raw/example_data.csv). The helper functions below show the state of the factory.

list_reports()       # list all available report sources
#> [1] "example_report.Rmd"
list_deps()          # list all of the dependencies of the reports
#> [1] "rmarkdown" "fs"        "knitr"
list_outputs()       # currently empty
#> character(0)

Step 3 - Compile report(s)

The compile_reports() function can be used to compile a report using regular expressions matched against the full filename of reports within the factory.

This ability to use of regular expressions is useful when you’re actively working on developing your reports but once the factory is setup we recommend passing full filenames to the function so it is always clear what will be built.

compile_reports( 
  reports = "example_report.Rmd"
)
#> >>> Compiling report: example_report
#> All done!

Use list_ouputs() to view the report outputs.

list_outputs()
#> [1] "example_report/2021-07-13_T12-16-03/example_report.html"
#> [2] "example_report/2021-07-13_T12-16-03/example_report.Rmd"

compile_reports() can also be used to pass a set of parameters to use with a parameterised report (here we use a subfolder argument to distinguish the parameterised reports).

compile_reports(
  reports = "example_report.Rmd",
  params = list(graph = FALSE),
  subfolder = "regional"
)
#> >>> Compiling report: example_report
#>       - with parameters: graph = FALSE
#> All done!
list_outputs()
#> [1] "example_report/2021-07-13_T12-16-03/example_report.html"         
#> [2] "example_report/2021-07-13_T12-16-03/example_report.Rmd"          
#> [3] "example_report/regional/2021-07-13_T12-16-04/example_report.html"
#> [4] "example_report/regional/2021-07-13_T12-16-04/example_report.Rmd"

Note that reports can also be an integer or a logical vector, in which case it is interpreted as a subset of files output by list_reports(). For instance:

  • compile_reports(reports = c(1, 3)) will compile the first and third reports listed by list_reports(); and
  • compile_reports(reports = TRUE) will compile all reports.

Factory overview

If you want to have an overview of your entire factory then you can use the factory_overview() function:

factory_overview()
#> /home/tim/github/reconverse/reportfactory/my_factory
#> ├── README.md
#> ├── data
#> │   ├── clean
#> │   └── raw
#> │       └── example_data.csv
#> ├── factory_config
#> ├── my_factory.Rproj
#> ├── outputs
#> │   └── example_report
#> │       ├── 2021-07-13_T12-16-03
#> │       │   ├── example_report.Rmd
#> │       │   └── example_report.html
#> │       └── regional
#> │           └── 2021-07-13_T12-16-04
#> │               ├── example_report.Rmd
#> │               └── example_report.html
#> ├── report_sources
#> │   └── example_report.Rmd
#> └── scripts

Contributing guidelines

Contributions are welcome via pull requests.

Code of Conduct

Please note that the reportfactory project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Metadata

Version

0.4.0

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows