[CHNOSZ-commits] r957 - in pkg/CHNOSZ: . R demo inst man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Jan 8 05:01:12 CET 2026
Author: jedick
Date: 2026-01-08 05:01:12 +0100 (Thu, 08 Jan 2026)
New Revision: 957
Added:
pkg/CHNOSZ/demo/demos.R
pkg/CHNOSZ/demo/demos_png.R
pkg/CHNOSZ/demo/examples.R
pkg/CHNOSZ/demo/examples_png.R
Removed:
pkg/CHNOSZ/R/examples.R
Modified:
pkg/CHNOSZ/DESCRIPTION
pkg/CHNOSZ/NAMESPACE
pkg/CHNOSZ/demo/00Index
pkg/CHNOSZ/inst/CHECKLIST
pkg/CHNOSZ/inst/NEWS.Rd
pkg/CHNOSZ/man/CHNOSZ-package.Rd
pkg/CHNOSZ/man/examples.Rd
Log:
Move examples() and demos() to meta-demos
Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION 2026-01-07 12:17:50 UTC (rev 956)
+++ pkg/CHNOSZ/DESCRIPTION 2026-01-08 04:01:12 UTC (rev 957)
@@ -1,6 +1,6 @@
-Date: 2026-01-07
+Date: 2026-01-08
Package: CHNOSZ
-Version: 2.2.0-23
+Version: 2.2.0-24
Title: Thermodynamic Calculations and Diagrams for Geochemistry
Authors at R: c(
person("Jeffrey", "Dick", , "j3ffdick at gmail.com", role = c("aut", "cre"),
Modified: pkg/CHNOSZ/NAMESPACE
===================================================================
--- pkg/CHNOSZ/NAMESPACE 2026-01-07 12:17:50 UTC (rev 956)
+++ pkg/CHNOSZ/NAMESPACE 2026-01-08 04:01:12 UTC (rev 957)
@@ -13,7 +13,7 @@
"unitize",
"thermo.refs", "mod.OBIGT",
# examples
- "examples", "demos", "mtitle",
+ "mtitle",
"list2array", "slice", "dimSums", "slice.affinity",
"add.OBIGT", "RH2OBIGT",
"expr.property", "expr.units",
Deleted: pkg/CHNOSZ/R/examples.R
===================================================================
--- pkg/CHNOSZ/R/examples.R 2026-01-07 12:17:50 UTC (rev 956)
+++ pkg/CHNOSZ/R/examples.R 2026-01-08 04:01:12 UTC (rev 957)
@@ -1,57 +0,0 @@
-# CHNOSZ/examples.R
-# Functions to run all examples and demos in the package
-
-examples <- function(save.png = FALSE) {
- # Run examples in each of the CHNOSZ help pages
- .ptime <- proc.time()
- topics <- c("thermo", "examples",
- "util.array", "util.data", "util.expression", "util.legend", "util.plot",
- "util.formula", "util.misc", "util.seq", "util.units",
- "util.water", "taxonomy", "info", "retrieve", "add.OBIGT", "protein.info",
- "water", "IAPWS95", "subcrt", "Berman",
- "makeup", "basis", "swap.basis", "species", "affinity",
- "solubility", "equilibrate",
- "diagram", "mosaic", "mix",
- "buffer", "nonideal", "NaCl",
- "add.protein", "ionize.aa", "EOSregress", "rank.affinity",
- "DEW", "logK.to.OBIGT", "stack_mosaic"
- )
- plot.it <- FALSE
- if(is.character(save.png))
- png(paste(save.png, "%d.png", sep = ""), width = 500, height = 500, pointsize = 12)
- else if(save.png) plot.it <- TRUE
- for(i in 1:length(topics)) {
- if(plot.it) png(paste(topics[i], "%d.png", sep = ""), width = 500, height = 500, pointsize = 12)
- myargs <- list(topic = topics[i], ask = FALSE)
- do.call(example, myargs)
- if(plot.it) dev.off()
- }
- if(is.character(save.png)) dev.off()
- cat("Time elapsed: ", proc.time() - .ptime, "\n")
-}
-
-demos <- function(which = c("references", "dehydration", "affinity", "NaCl", "density",
- "ORP", "ionize", "buffer", "protbuff", "glycinate",
- "mosaic", "copper", "arsenic", "solubility", "gold", "contour", "sphalerite", "minsol",
- "Shh", "saturation", "adenine", "DEW", "lambda", "potassium", "TCA", "aluminum",
- "AD", "comproportionation", "Pourbaix", "E_coli", "yttrium", "rank.affinity", "uranyl",
- "sum_S", "MgATP", "rubisco_Zc", "phosphorylate"),
- save.png = FALSE) {
- # Run one or more demos from CHNOSZ with ask = FALSE, and return the value of the last one
- out <- NULL
- for(i in 1:length(which)) {
- # A message so the user knows where we are
- message("------------")
- message(paste("demos: running '", which[i], "'", sep = ""))
- width <- 500
- height <- 500
- pointsize <- 12
- if(which[i] == "comproportionation") width <- 600
- if(which[i] == "phosphorylate") {width <- 800; height <- 600; pointsize <- 16}
- if(save.png) png(paste(which[i], "%d.png", sep = ""), width = width, height = height, pointsize = pointsize)
- out <- demo(which[i], package = "CHNOSZ", character.only = TRUE, echo = FALSE, ask = FALSE)
- if(save.png) dev.off()
- }
- return(invisible(out))
-}
-
Modified: pkg/CHNOSZ/demo/00Index
===================================================================
--- pkg/CHNOSZ/demo/00Index 2026-01-07 12:17:50 UTC (rev 956)
+++ pkg/CHNOSZ/demo/00Index 2026-01-08 04:01:12 UTC (rev 957)
@@ -1,3 +1,7 @@
+demos Meta-demo that runs all other demos (screen output)
+demos_png Meta-demo that runs all other demos (PNG output)
+examples Demo that runs all examples in the package (screen output)
+examples_png Demo that runs all examples in the package (PNG output)
references Cross-check the references in refs.csv with the thermodynamic database
affinity Affinities of metabolic reactions and amino acid synthesis
NaCl Equilibrium constant for aqueous NaCl dissociation
@@ -36,3 +40,4 @@
MgATP Speciation of ATP with H+ and Mg+2
rubisco_Zc Zc of Rubisco vs optimal growth temperature
phosphorylate Phosphorylation model for Gibbs energy of nucleotide polymerization into RNA
+
Added: pkg/CHNOSZ/demo/demos.R
===================================================================
--- pkg/CHNOSZ/demo/demos.R (rev 0)
+++ pkg/CHNOSZ/demo/demos.R 2026-01-08 04:01:12 UTC (rev 957)
@@ -0,0 +1,18 @@
+# CHNOSZ/demo/demos.R
+# Run all demos in the package
+
+library(CHNOSZ)
+
+demos <- c("references", "dehydration", "affinity", "NaCl", "density",
+ "ORP", "ionize", "buffer", "protbuff", "glycinate",
+ "mosaic", "copper", "arsenic", "solubility", "gold", "contour", "sphalerite", "minsol",
+ "Shh", "saturation", "adenine", "DEW", "lambda", "potassium", "TCA", "aluminum",
+ "AD", "comproportionation", "Pourbaix", "E_coli", "yttrium", "rank.affinity", "uranyl",
+ "sum_S", "MgATP", "rubisco_Zc", "phosphorylate")
+
+for(i in 1:length(demos)) {
+ # A message so the user knows where we are
+ message("------------")
+ message(paste("demos: running '", demos[i], "'", sep = ""))
+ demo(demos[i], package = "CHNOSZ", character.only = TRUE, echo = FALSE, ask = FALSE)
+}
Added: pkg/CHNOSZ/demo/demos_png.R
===================================================================
--- pkg/CHNOSZ/demo/demos_png.R (rev 0)
+++ pkg/CHNOSZ/demo/demos_png.R 2026-01-08 04:01:12 UTC (rev 957)
@@ -0,0 +1,25 @@
+# CHNOSZ/demo/demos_png.R
+# Run all demos in the package, saving output to PNG files
+
+library(CHNOSZ)
+
+demos <- c("references", "dehydration", "affinity", "NaCl", "density",
+ "ORP", "ionize", "buffer", "protbuff", "glycinate",
+ "mosaic", "copper", "arsenic", "solubility", "gold", "contour", "sphalerite", "minsol",
+ "Shh", "saturation", "adenine", "DEW", "lambda", "potassium", "TCA", "aluminum",
+ "AD", "comproportionation", "Pourbaix", "E_coli", "yttrium", "rank.affinity", "uranyl",
+ "sum_S", "MgATP", "rubisco_Zc", "phosphorylate")
+
+for(i in 1:length(demos)) {
+ # A message so the user knows where we are
+ message("------------")
+ message(paste("demos: running '", demos[i], "'", sep = ""))
+ width <- 500
+ height <- 500
+ pointsize <- 12
+ if(demos[i] == "comproportionation") width <- 600
+ if(demos[i] == "phosphorylate") {width <- 800; height <- 600; pointsize <- 16}
+ png(paste(demos[i], "%d.png", sep = ""), width = width, height = height, pointsize = pointsize)
+ demo(demos[i], package = "CHNOSZ", character.only = TRUE, echo = FALSE, ask = FALSE)
+ dev.off()
+}
Copied: pkg/CHNOSZ/demo/examples.R (from rev 956, pkg/CHNOSZ/R/examples.R)
===================================================================
--- pkg/CHNOSZ/demo/examples.R (rev 0)
+++ pkg/CHNOSZ/demo/examples.R 2026-01-08 04:01:12 UTC (rev 957)
@@ -0,0 +1,20 @@
+# CHNOSZ/demo/examples.R
+# Run all examples in the package
+
+library(CHNOSZ)
+
+.ptime <- proc.time()
+topics <- c("thermo", "examples",
+ "util.array", "util.data", "util.expression", "util.legend", "util.plot",
+ "util.formula", "util.misc", "util.seq", "util.units",
+ "util.water", "taxonomy", "info", "retrieve", "add.OBIGT", "protein.info",
+ "water", "IAPWS95", "subcrt", "Berman",
+ "makeup", "basis", "swap.basis", "species", "affinity",
+ "solubility", "equilibrate",
+ "diagram", "mosaic", "mix",
+ "buffer", "nonideal", "NaCl",
+ "add.protein", "ionize.aa", "EOSregress", "rank.affinity",
+ "DEW", "logK.to.OBIGT", "stack_mosaic"
+)
+for(i in 1:length(topics)) example(topics[i], package = "CHNOSZ", character.only = TRUE, ask = FALSE)
+cat("Time elapsed: ", proc.time() - .ptime, "\n")
Added: pkg/CHNOSZ/demo/examples_png.R
===================================================================
--- pkg/CHNOSZ/demo/examples_png.R (rev 0)
+++ pkg/CHNOSZ/demo/examples_png.R 2026-01-08 04:01:12 UTC (rev 957)
@@ -0,0 +1,24 @@
+# CHNOSZ/demo/examples_png.R
+# Run all examples in the package, saving output to PNG files
+
+library(CHNOSZ)
+
+.ptime <- proc.time()
+topics <- c("thermo", "examples",
+ "util.array", "util.data", "util.expression", "util.legend", "util.plot",
+ "util.formula", "util.misc", "util.seq", "util.units",
+ "util.water", "taxonomy", "info", "retrieve", "add.OBIGT", "protein.info",
+ "water", "IAPWS95", "subcrt", "Berman",
+ "makeup", "basis", "swap.basis", "species", "affinity",
+ "solubility", "equilibrate",
+ "diagram", "mosaic", "mix",
+ "buffer", "nonideal", "NaCl",
+ "add.protein", "ionize.aa", "EOSregress", "rank.affinity",
+ "DEW", "logK.to.OBIGT", "stack_mosaic"
+)
+for(i in 1:length(topics)) {
+ png(paste(topics[i], "%d.png", sep = ""), width = 500, height = 500, pointsize = 12)
+ example(topics[i], package = "CHNOSZ", character.only = TRUE, ask = FALSE)
+ dev.off()
+}
+cat("Time elapsed: ", proc.time() - .ptime, "\n")
Modified: pkg/CHNOSZ/inst/CHECKLIST
===================================================================
--- pkg/CHNOSZ/inst/CHECKLIST 2026-01-07 12:17:50 UTC (rev 956)
+++ pkg/CHNOSZ/inst/CHECKLIST 2026-01-08 04:01:12 UTC (rev 957)
@@ -1,9 +1,11 @@
****************************
Release checklist for CHNOSZ
- (updated 2024-12-25)
+ (updated 2026-01-08)
****************************
-- Run examples() and demos() and inspect their output (especially plots)
+- Run all examples and demos and inspect their output (especially plots):
+ demo(examples_png, ask = FALSE)
+ demo(demos_png, ask = FALSE)
- Run the package tests with:
suppressMessages(tinytest::test_package("CHNOSZ", at_home = TRUE))
Modified: pkg/CHNOSZ/inst/NEWS.Rd
===================================================================
--- pkg/CHNOSZ/inst/NEWS.Rd 2026-01-07 12:17:50 UTC (rev 956)
+++ pkg/CHNOSZ/inst/NEWS.Rd 2026-01-08 04:01:12 UTC (rev 957)
@@ -15,7 +15,7 @@
\newcommand{\Cp}{\ifelse{latex}{\eqn{C_P}}{\ifelse{html}{\out{<I>C<sub>P</sub></I>}}{Cp}}}
\newcommand{\DG0}{\ifelse{latex}{\eqn{{\Delta}G^{\circ}}}{\ifelse{html}{\out{Δ<I>G</I>°}}{ΔG°}}}
-\section{Changes in CHNOSZ version 2.2.0-20 (2026-01-07)}{
+\section{Changes in CHNOSZ version 2.2.0-23 (2026-01-07)}{
\itemize{
@@ -56,6 +56,13 @@
\code{Psublm}, \code{TsHGK}, \code{TdPsdT}, \code{tcorr}, and
\code{cpswap}.
+ \item Add CI workflow for Codecov.
+
+ \item Move \code{demos()} and \code{examples()} functions to demos. These
+ "meta-demos" show output on screen (\file{demo/demos.R},
+ \file{demo/examples.R}) or save to PNG files (\file{demo/demos_png.R},
+ \file{demo/examples_png.R})
+
}
}
Modified: pkg/CHNOSZ/man/CHNOSZ-package.Rd
===================================================================
--- pkg/CHNOSZ/man/CHNOSZ-package.Rd 2026-01-07 12:17:50 UTC (rev 956)
+++ pkg/CHNOSZ/man/CHNOSZ-package.Rd 2026-01-08 04:01:12 UTC (rev 957)
@@ -8,11 +8,11 @@
It can be used to calculate the standard molal thermodynamic properties and chemical affinities of reactions relevant to geobiochemical processes, and to visualize the equilibrium activities of species on chemical speciation and predominance diagrams.
}
-\section{Warm Tips}{
+\section{Tips}{
\itemize{
\item To view the manual, run \code{help.start()} then select \sQuote{Packages} and \sQuote{CHNOSZ}. Examples in the function help pages can be run by pasting the code block into the \R console.
\item Also check out the vignette \viglink{anintro} (\emph{An Introduction to CHNOSZ}).
- \item Run the command \code{\link{examples}()} to run all of the examples provided in CHNOSZ. This should take about a minute.
+ \item See \code{\link{examples}()} to run all of the examples and demos in the package.
}
}
Modified: pkg/CHNOSZ/man/examples.Rd
===================================================================
--- pkg/CHNOSZ/man/examples.Rd 2026-01-07 12:17:50 UTC (rev 956)
+++ pkg/CHNOSZ/man/examples.Rd 2026-01-08 04:01:12 UTC (rev 957)
@@ -2,35 +2,21 @@
\name{examples}
\alias{examples}
\alias{demos}
-\title{Run examples from the documentation}
+\title{Run package examples and demos}
\description{
- Run the examples contained in each of the documentation topics. }
-
-\arguments{
- \item{save.png}{logical, generate PNG image files for the plots?}
- \item{which}{character, which example to run}
+ Run examples and demos in the package, showing output on screen or saved to PNG files.
}
-\usage{
- examples(save.png = FALSE)
- demos(which = c("references", "dehydration", "affinity", "NaCl",
- "density", "ORP", "ionize", "buffer", "protbuff",
- "glycinate", "mosaic", "copper", "arsenic", "solubility", "gold",
- "contour", "sphalerite", "minsol", "Shh", "saturation",
- "adenine", "DEW", "lambda", "potassium", "TCA", "aluminum", "AD",
- "comproportionation", "Pourbaix", "E_coli", "yttrium", "rank.affinity",
- "uranyl", "sum_S", "MgATP", "rubisco_Zc", "phosphorylate"),
- save.png = FALSE)
-}
-
\details{
-\code{examples} runs all the examples in the help pages for the package.
-\code{\link{example}} is called for each topic with \code{ask} set to \code{FALSE} (so all of the figures are shown without prompting the user).
+\code{examples} and \code{demos} are meta-demos that run all the examples (from the help pages) and other demos in the package.
+Run these demos with \code{ask = FALSE} to proceed without asking the user.
-\code{demos} runs all the \code{\link{demo}s} in the package.
-The demo(s) to run is/are specified by \code{which}; the default is to run them in the order of the list below.
+\code{examples_png} and \code{demos_png} run all the examples and demos, saving output to PNG files.
+The plots are saved in \code{\link{png}} files whose names begin with the names of the help topics or demos.
+The package demos are described below.
+
\describe{
\item{references}{Cross-check the references in refs.csv with the thermodynamic database}
\item{affinity}{Affinities of metabolic reactions and amino acid synthesis (Amend and Shock, 1998, 2001)}
@@ -72,7 +58,6 @@
\item{phosphorylate}{Phosphorylation model for Gibbs energy of nucleotide polymerization into RNA (LaRowe and Dick, 2025)}
}
-For either function, if \code{save.png} is TRUE, the plots are saved in \code{\link{png}} files whose names begin with the names of the help topics or demos.
Two of the demos have external dependencies and are not automatically run by \code{demos}.
\samp{carboxylase} creates an animated GIF; this demo requires that the ImageMagick \code{convert} commmand be available on the system (tested on Linux and Windows).
@@ -171,10 +156,11 @@
\examples{
-\dontshow{reset()}
-\dontshow{opar <- par(no.readonly = TRUE)}
-demos(c("ORP", "NaCl"))
-\dontshow{par(opar)}
+# Run all the examples (about 20 s)
+\dontrun{demo(examples, ask = FALSE)}
+
+# Run all the demos (about 4 min)
+\dontrun{demo(demos, ask = FALSE)}
}
\concept{Other tools}
More information about the CHNOSZ-commits
mailing list