aboutsummaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2022-12-19 12:31:56 +0100
committerJohannes Ranke <jranke@uni-bremen.de>2022-12-19 12:38:07 +0100
commit886c9ef013124aa954d960c655b349b5340ff154 (patch)
treecc25364040ce87893d21581380de48c7e9bee422 /R
parent0023df3c31fac29b5f9337ecd732a5dfd4d51a2d (diff)
Rename template folder, create format
Instead of rmarkdown::pdf_document, mkin::hierarchical_kinetics is used as a document format in the template. In this way, the template file can be freed from some R code and yaml options that the average user does not have to be aware of.
Diffstat (limited to 'R')
-rw-r--r--R/hierarchical_kinetics.R39
-rw-r--r--R/parplot.R2
2 files changed, 40 insertions, 1 deletions
diff --git a/R/hierarchical_kinetics.R b/R/hierarchical_kinetics.R
new file mode 100644
index 00000000..f7ffb333
--- /dev/null
+++ b/R/hierarchical_kinetics.R
@@ -0,0 +1,39 @@
+#' 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("New 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)
+ knitr::opts_chunk$set(fig.align = "center", fig.pos = "H")
+ options(knitr.kable.NA = "")
+
+ fmt <- rmarkdown::pdf_document(...,
+ keep_tex = keep_tex,
+ toc = TRUE,
+ includes = rmarkdown::includes(in_header = "header.tex"),
+ extra_dependencies = c("float", "listing", "framed")
+ )
+
+ return(fmt)
+}
diff --git a/R/parplot.R b/R/parplot.R
index e9c18947..3da4b51a 100644
--- a/R/parplot.R
+++ b/R/parplot.R
@@ -23,7 +23,7 @@
#' of the in vitro erythropoiesis. BMC Bioinformatics. 2021 Oct 4;22(1):478.
#' doi: 10.1186/s12859-021-04373-4.
#' @seealso [multistart]
-#' @importFrom stats median
+#' @importFrom stats median quantile
#' @export
parplot <- function(object, ...) {
UseMethod("parplot")

Contact - Imprint