aboutsummaryrefslogtreecommitdiff
path: root/R/hierarchical_kinetics.R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2023-02-13 05:19:08 +0100
committerJohannes Ranke <jranke@uni-bremen.de>2023-02-13 05:19:08 +0100
commit8d1a84ac2190538ed3bac53a303064e281595868 (patch)
treeacb894d85ab7ec87c4911c355a5264a77e08e34b /R/hierarchical_kinetics.R
parent51d63256a7b3020ee11931d61b4db97b9ded02c0 (diff)
parent4200e566ad2600f56bc3987669aeab88582139eb (diff)
Merge branch 'main' into custom_lsoda_call
Diffstat (limited to 'R/hierarchical_kinetics.R')
-rw-r--r--R/hierarchical_kinetics.R40
1 files changed, 40 insertions, 0 deletions
diff --git a/R/hierarchical_kinetics.R b/R/hierarchical_kinetics.R
new file mode 100644
index 00000000..e545754a
--- /dev/null
+++ b/R/hierarchical_kinetics.R
@@ -0,0 +1,40 @@
+#' Hierarchical kinetics template
+#'
+#' R markdown format for setting up hierarchical kinetics based on a template
+#' provided with the mkin package.
+#'
+#' @inheritParams rmarkdown::pdf_document
+#' @param ... Arguments to \code{rmarkdown::pdf_document}
+#'
+#' @return R Markdown output format to pass to
+#' \code{\link[rmarkdown:render]{render}}
+#'
+#' @examples
+#'
+#' \dontrun{
+#' library(rmarkdown)
+#' draft("example_analysis.rmd", template = "hierarchical_kinetics", package = "mkin")
+#' }
+#'
+#' @export
+hierarchical_kinetics <- function(..., keep_tex = FALSE) {
+
+ if (getRversion() < "4.1.0")
+ stop("You need R with version > 4.1.0 to compile this document")
+
+ if (!requireNamespace("knitr")) stop("Please install the knitr package to use this template")
+ if (!requireNamespace("rmarkdown")) stop("Please install the rmarkdown package to use this template")
+ knitr::opts_chunk$set(echo = FALSE, cache = TRUE, comment = "", tidy = FALSE, echo = TRUE)
+ knitr::opts_chunk$set(fig.align = "center", fig.pos = "H")
+ options(knitr.kable.NA = "")
+
+ fmt <- rmarkdown::pdf_document(...,
+ keep_tex = keep_tex,
+ toc = TRUE,
+ toc_depth = 3,
+ includes = rmarkdown::includes(in_header = "header.tex"),
+ extra_dependencies = c("float", "listing", "framed")
+ )
+
+ return(fmt)
+}

Contact - Imprint