From 886c9ef013124aa954d960c655b349b5340ff154 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Mon, 19 Dec 2022 12:31:56 +0100 Subject: 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. --- R/hierarchical_kinetics.R | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 R/hierarchical_kinetics.R (limited to 'R/hierarchical_kinetics.R') 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) +} -- cgit v1.2.1 From a89a835e0fd6fe55e4c7353e99cc442c4d309bc1 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Mon, 2 Jan 2023 10:25:47 +0100 Subject: Echo R code per default in markdown template --- R/hierarchical_kinetics.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'R/hierarchical_kinetics.R') diff --git a/R/hierarchical_kinetics.R b/R/hierarchical_kinetics.R index f7ffb333..70e0100a 100644 --- a/R/hierarchical_kinetics.R +++ b/R/hierarchical_kinetics.R @@ -24,7 +24,7 @@ hierarchical_kinetics <- function(..., keep_tex = FALSE) { 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(echo = FALSE, cache = TRUE, comment = "", tidy = FALSE, echo = TRUE) knitr::opts_chunk$set(fig.align = "center", fig.pos = "H") options(knitr.kable.NA = "") -- cgit v1.2.1 From ed2ab7bba07e3cb036782227fe27943f4b5583fa Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Tue, 3 Jan 2023 09:31:48 +0100 Subject: Improved skeleton for hierarchical fits Now with working pathway fits using SFORB-SFO2 (only two parallel metabolites instead of three) as the data for compound Ia was not sufficient for a reliable fit. --- R/hierarchical_kinetics.R | 1 + 1 file changed, 1 insertion(+) (limited to 'R/hierarchical_kinetics.R') diff --git a/R/hierarchical_kinetics.R b/R/hierarchical_kinetics.R index 70e0100a..a90dd619 100644 --- a/R/hierarchical_kinetics.R +++ b/R/hierarchical_kinetics.R @@ -31,6 +31,7 @@ hierarchical_kinetics <- function(..., keep_tex = FALSE) { 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") ) -- cgit v1.2.1 From 24eb77216700cf8b2f2bde3abad84c1f83f9e32a Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Mon, 9 Jan 2023 06:22:04 +0100 Subject: Prebuilt PDF vignettes, summary_listing --- R/hierarchical_kinetics.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'R/hierarchical_kinetics.R') diff --git a/R/hierarchical_kinetics.R b/R/hierarchical_kinetics.R index a90dd619..e545754a 100644 --- a/R/hierarchical_kinetics.R +++ b/R/hierarchical_kinetics.R @@ -13,7 +13,7 @@ #' #' \dontrun{ #' library(rmarkdown) -#' draft("New analysis.rmd", template = "hierarchical_kinetics", package = "mkin") +#' draft("example_analysis.rmd", template = "hierarchical_kinetics", package = "mkin") #' } #' #' @export -- cgit v1.2.1