This vignette shows how rmonad
can be used in tandem with Nozzle.R1
to
create HTML reports. Nozzle.R1
is a published R package for report
generation:
library(Nozzle.R1)
citation('Nozzle.R1')
##
## To cite package 'Nozzle.R1' in publications use:
##
## Nils Gehlenborg (2013). Nozzle.R1: Nozzle Reports. R package version
## 1.1-1. https://CRAN.R-project.org/package=Nozzle.R1
##
## A BibTeX entry for LaTeX users is
##
## @Manual{,
## title = {Nozzle.R1: Nozzle Reports},
## author = {Nils Gehlenborg},
## year = {2013},
## note = {R package version 1.1-1},
## url = {https://CRAN.R-project.org/package=Nozzle.R1},
## }
##
## ATTENTION: This citation information has been auto-generated from the
## package DESCRIPTION file and may need manual editing, see
## 'help("citation")'.
It can be used to build HTML reports section by section. The package offers a
report generation approach that is more programmable, in some ways, than
standard literate programming approaches (e.g. knitr
). rmonad
is intended
to store all the data needed for a report, but stop short of actually creating
one. These two packages are thus highly complementary.
Here is a simple example:
m <- iris %>>% head(20) %v>% summary %v>% colSums
r <- newCustomReport("Demo report")
r <- setMaintainerName(r, "Uriah Heep")
s1 <- newSection("Pipeline overview")
fig1 <- "p1.png"
png(fig1)
plot(m)
dev.off()
s1 <- addTo(s1,
newFigure(fig1, "Pipeline graph"),
newTable(mtabulate(m), "Pipeline summary")
)
r <- addTo(r, s1)
s2 <- newSection("Results")
s2 <- addTo(s2, newTable(get_value(m, 2)[[1]], get_code(m, 2)[[1]]))
s2 <- addTo(s2, newTable(get_value(m, 2)[[1]], get_code(m, 2)[[1]]))
r <- addTo(r, s2)
if(any(has_error(m) | has_warnings(m))){
s3 <- newSection("Bad things")
s3 <- addTo(s3, newTable(missues(m), "Issues raised"))
r <- addTo(r, s3)
}
writeReport(r, filename="demo")