aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--DESCRIPTION2
-rw-r--r--NAMESPACE1
-rw-r--r--NEWS.md4
-rw-r--r--R/tex_listing.R32
-rw-r--r--man/tex_listing.Rd20
5 files changed, 58 insertions, 1 deletions
diff --git a/DESCRIPTION b/DESCRIPTION
index aa5cfee2..bb9ae3a5 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -2,7 +2,7 @@ Package: mkin
Type: Package
Title: Kinetic Evaluation of Chemical Degradation Data
Version: 1.2.0
-Date: 2022-09-16
+Date: 2022-11-01
Authors@R: c(
person("Johannes", "Ranke", role = c("aut", "cre", "cph"),
email = "johannes.ranke@jrwb.de",
diff --git a/NAMESPACE b/NAMESPACE
index 8dff6a26..9c85945e 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -144,6 +144,7 @@ export(set_nd_nq)
export(set_nd_nq_focus)
export(sigma_twocomp)
export(status)
+export(tex_listing)
export(transform_odeparms)
export(which.best)
import(deSolve)
diff --git a/NEWS.md b/NEWS.md
index 345cc50c..ebd9a9f5 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -16,6 +16,10 @@
- 'R/saem.R': Implement and test saemix transformations for FOMC and HS. Also, error out if saemix transformations are requested but not supported.
+- 'R/read_spreadsheet.R': Conveniently read in data from a spreadsheet file.
+
+- 'R/tex_listings.R': Conveniently include summaries of fit objects in R markdown documents that are compiled to LaTeX.
+
# mkin 1.1.1 (2022-07-12)
- 'R/{mkinmod,mkinpredict}.R: Store DLL information in mkinmod objects and use that information in mkinpredict to avoid a performance regression brought by a bugfix in R 4.2.x. Thanks to Tomas Kalibera for his analysis of the problem on the r-package-devel list and his suggestion on how to fix it.
diff --git a/R/tex_listing.R b/R/tex_listing.R
new file mode 100644
index 00000000..05f662e4
--- /dev/null
+++ b/R/tex_listing.R
@@ -0,0 +1,32 @@
+#' Wrap the output of a summary function in tex listing environment
+#'
+#' This function can be used in a R markdown code chunk with the chunk
+#' option `results = "asis"`.
+#'
+#' @param object The object for which the summary is to be listed
+#' @param caption An optional caption
+#' @param label An optional label
+#' @param clearpage Should a new page be started after the listing?
+#' @export
+tex_listing <- function(object, caption = NULL, label = NULL,
+ clearpage = TRUE) {
+ cat("\n")
+ cat("\\begin{listing}", "\n")
+ if (!is.null(caption)) {
+ cat("\\caption{", caption, "}", "\n", sep = "")
+ }
+ if (!is.null(label)) {
+ cat("\\caption{", label, "}", "\n", sep = "")
+ }
+ cat("\\begin{snugshade}", "\n")
+ cat("\\scriptsize", "\n")
+ cat("\\begin{verbatim}", "\n")
+ cat(capture.output(suppressWarnings(summary(object))), sep = "\n")
+ cat("\n")
+ cat("\\end{verbatim}", "\n")
+ cat("\\end{snugshade}", "\n")
+ cat("\\end{listing}", "\n")
+ if (clearpage) {
+ cat("\\clearpage", "\n")
+ }
+}
diff --git a/man/tex_listing.Rd b/man/tex_listing.Rd
new file mode 100644
index 00000000..236853b7
--- /dev/null
+++ b/man/tex_listing.Rd
@@ -0,0 +1,20 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/tex_listing.R
+\name{tex_listing}
+\alias{tex_listing}
+\title{Wrap the output of a summary function in tex listing environment}
+\usage{
+tex_listing(object, caption = NULL, label = NULL, clearpage = TRUE)
+}
+\arguments{
+\item{object}{The object for which the summary is to be listed}
+
+\item{caption}{An optional caption}
+
+\item{label}{An optional label}
+
+\item{clearpage}{Should a new page be started after the listing?}
+}
+\description{
+Wrap the output of a summary function in tex listing environment
+}

Contact - Imprint