[CHNOSZ-commits] r948 - in pkg/CHNOSZ: . R demo inst man vignettes

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jan 6 07:10:47 CET 2026


Author: jedick
Date: 2026-01-06 07:10:46 +0100 (Tue, 06 Jan 2026)
New Revision: 948

Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/NAMESPACE
   pkg/CHNOSZ/R/util.legend.R
   pkg/CHNOSZ/demo/contour.R
   pkg/CHNOSZ/demo/minsol.R
   pkg/CHNOSZ/demo/mosaic.R
   pkg/CHNOSZ/demo/sphalerite.R
   pkg/CHNOSZ/demo/sum_S.R
   pkg/CHNOSZ/inst/NEWS.Rd
   pkg/CHNOSZ/man/mix.Rd
   pkg/CHNOSZ/man/solubility.Rd
   pkg/CHNOSZ/man/stack_mosaic.Rd
   pkg/CHNOSZ/man/util.legend.Rd
   pkg/CHNOSZ/vignettes/anintro.Rmd
   pkg/CHNOSZ/vignettes/multi-metal.Rmd
Log:
Remove lex()


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2026-01-05 07:51:47 UTC (rev 947)
+++ pkg/CHNOSZ/DESCRIPTION	2026-01-06 06:10:46 UTC (rev 948)
@@ -1,6 +1,6 @@
-Date: 2026-01-05
+Date: 2026-01-06
 Package: CHNOSZ
-Version: 2.2.0-14
+Version: 2.2.0-15
 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-05 07:51:47 UTC (rev 947)
+++ pkg/CHNOSZ/NAMESPACE	2026-01-06 06:10:46 UTC (rev 948)
@@ -52,7 +52,7 @@
   "dumpdata", "thermo.axis", "solubility", "NaCl",
 # added 20190213 or later
   "CHNOSZ", "thermo", "reset", "OBIGT", "retrieve", "moles",
-  "lNaCl", "lS", "lT", "lP", "lTP", "lex",
+  "lNaCl", "lS", "lT", "lP", "lTP",
 # added 20200716 or later
   "mash", "mix", "rebalance",
 # added 20220324

Modified: pkg/CHNOSZ/R/util.legend.R
===================================================================
--- pkg/CHNOSZ/R/util.legend.R	2026-01-05 07:51:47 UTC (rev 947)
+++ pkg/CHNOSZ/R/util.legend.R	2026-01-06 06:10:46 UTC (rev 948)
@@ -11,5 +11,3 @@
 lP <- function(x, digits = 0) if(identical(x, "Psat")) quote(italic(P)[sat]) else substitute(x~bar, list(x = round(x, digits)))
 
 lTP <- function(x, y, digits = 0) substitute(list(x, y), list(x = lT(x, digits), y = lP(y, digits)))
-
-lex <- function(...) as.expression(c(...))

Modified: pkg/CHNOSZ/demo/contour.R
===================================================================
--- pkg/CHNOSZ/demo/contour.R	2026-01-05 07:51:47 UTC (rev 947)
+++ pkg/CHNOSZ/demo/contour.R	2026-01-06 06:10:46 UTC (rev 948)
@@ -56,8 +56,8 @@
   diagram(s, levels = c(1, 10, 100, 1000), col = 1, add = TRUE)
   # Add legend and title
   dP <- describe.property(c("T", "P"), c(T, P))
-  lexpr <- lex(dP, lNaCl(m_NaCl), lS(sum_S))
-  legend("topright", lexpr, bty = "n")
+  lexpr <- c(dP, lNaCl(m_NaCl), lS(sum_S))
+  legend("topright", legend = lexpr, bty = "n")
   if(i == 1) title(main = ("Gold solubility (ppb), after Ding et al., 2023 (default data)"), font.main = 1)
   if(i == 2) title(main = ("Gold solubility (ppb), after Ding et al., 2023 (optional data)"), font.main = 1)
 

Modified: pkg/CHNOSZ/demo/minsol.R
===================================================================
--- pkg/CHNOSZ/demo/minsol.R	2026-01-05 07:51:47 UTC (rev 947)
+++ pkg/CHNOSZ/demo/minsol.R	2026-01-06 06:10:46 UTC (rev 948)
@@ -52,7 +52,7 @@
   lNaCl(mNaCl),
   lS(Stot)
 )
-legend("topleft", legend = lex(l), bty = "n", cex = 1.5)
+legend("topleft", legend = l, bty = "n", cex = 1.5)
 # Describe steps
 par(xpd = NA)
 legend("bottomleft", c("Predominance diagram: molality of aqueous", "species defines one solubility contour.",

Modified: pkg/CHNOSZ/demo/mosaic.R
===================================================================
--- pkg/CHNOSZ/demo/mosaic.R	2026-01-05 07:51:47 UTC (rev 947)
+++ pkg/CHNOSZ/demo/mosaic.R	2026-01-06 06:10:46 UTC (rev 948)
@@ -76,15 +76,13 @@
   bquote(sum("S(aq)") == 10^.(loga_S)~m),
   bquote(sum("C(aq)") == 10^.(loga_C)~m)
 )
-legend1 <- lex(TP, SC)
-legend("topright", legend1, bty = "n")
+legend("topright", legend = c(TP, SC), bty = "n")
 
 Fe <- c(
   bquote(10^-4~"m Fe"),
   bquote(10^-6~"m Fe")
 )
-legend2 <- lex(Fe)
-legend("bottomleft", legend2, lty = c(3, 1), bty = "n")
+legend("bottomleft", legend = Fe, lty = c(3, 1), bty = "n")
 
 title(main = paste("Iron oxides, sulfides, and carbonate in water,",
   "after Garrels and Christ, 1965, Figure 7.21", sep = "\n"), font.main = 1)

Modified: pkg/CHNOSZ/demo/sphalerite.R
===================================================================
--- pkg/CHNOSZ/demo/sphalerite.R	2026-01-05 07:51:47 UTC (rev 947)
+++ pkg/CHNOSZ/demo/sphalerite.R	2026-01-06 06:10:46 UTC (rev 948)
@@ -32,7 +32,7 @@
   abline(v = pKw / 2, lty = 2, lwd = 2, col = "blue1")
 
   # Add legend
-  l <- lex(lNaCl(m_NaCl), lTP(T, P))
+  l <- c(lNaCl(m_NaCl), lTP(T, P))
   legend("topright", legend = l, bty = "n")
 }
 

Modified: pkg/CHNOSZ/demo/sum_S.R
===================================================================
--- pkg/CHNOSZ/demo/sum_S.R	2026-01-05 07:51:47 UTC (rev 947)
+++ pkg/CHNOSZ/demo/sum_S.R	2026-01-06 06:10:46 UTC (rev 948)
@@ -5,7 +5,7 @@
 library(CHNOSZ)
 
 # Define conditions
-res <- 500
+res <- 300
 loga_S <- c(-6, 0, res)
 logf_O2 <- c(-45, -20, res)
 pH <- 5
@@ -22,7 +22,7 @@
 
 # Setup chemical system
 # Use oxygen instead of O2 to get the gas
-basis(c("Fe", "SO4-2", "oxygen", "H+", "Cl-", "H2O"))
+basis(c("Fe", "H2S", "oxygen", "H+", "Cl-", "H2O"))
 basis("pH", pH)
 basis("Cl-", log10(NaCl$m_Clminus))
 # Add minerals as formed species
@@ -31,7 +31,7 @@
 # List basis species to swap through
 bases <- list( c("H2S", "HS-", "S3-", "SO2", "HSO4-", "SO4-2") )
 # Calculate mosaic for Fe minerals
-m <- mosaic(bases, "SO4-2" = loga_S, O2 = logf_O2, T = T, P = P, IS = IS)
+m <- mosaic(bases, "H2S" = loga_S, O2 = logf_O2, T = T, P = P, IS = IS)
 
 # Loop over metals for solubility contours
 for(metal in c("Fe", "Au")) {
@@ -44,7 +44,7 @@
 
   if(metal == "Au") {
     # Put Au as the first basis species for solubility() calculation
-    basis(c("Au", "SO4-2", "oxygen", "H+", "Cl-", "H2O"))
+    basis(c("Au", "H2S", "oxygen", "H+", "Cl-", "H2O"))
     basis("pH", pH)
     # This is the species whose solubility we want to calculate
     species("Au")
@@ -60,7 +60,7 @@
     cols <- c(2, 2)
   }
   # Calculate solubility and convert log molality to ppb
-  s <- solubility(iaq, bases = bases, "SO4-2" = loga_S, O2 = logf_O2, T = T, P = P, IS = IS, in.terms.of = metal)
+  s <- solubility(iaq, bases = bases, "H2S" = loga_S, O2 = logf_O2, T = T, P = P, IS = IS, in.terms.of = metal)
   sp <- convert(s, "ppb")
   # Plot twice to get deeper colors
   for(col in cols) {
@@ -70,7 +70,7 @@
   # Add legend and title
   T_P <- describe.property(c("T", "P"), c(T, P))
   P_Cl <- c(bquote(pH == .(pH)), bquote(NaCl == .(m_NaCl)~mol~kg^-1))
-  legend <- lex(T_P, P_Cl)
+  legend <- c(T_P, P_Cl)
   legend("topright", legend, bty = "n")
   main <- paste("Fe minerals with summed aq species: S (x-axis) and ppb", metal, "(contours)")
   title(main, font.main = 1)

Modified: pkg/CHNOSZ/inst/NEWS.Rd
===================================================================
--- pkg/CHNOSZ/inst/NEWS.Rd	2026-01-05 07:51:47 UTC (rev 947)
+++ pkg/CHNOSZ/inst/NEWS.Rd	2026-01-06 06:10:46 UTC (rev 948)
@@ -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-14 (2026-01-05)}{
+\section{Changes in CHNOSZ version 2.2.0-15 (2026-01-06)}{
 
     \itemize{
 
@@ -47,6 +47,9 @@
       calculations in examples, demos, and vignettes. Thanks to Evgeniy
       Bastrakov for suggesting this change.
 
+      \item Remove \code{lex()}, which only wrapped its argument in
+      \code{as.expression(c())}.
+
     }
 
 }

Modified: pkg/CHNOSZ/man/mix.Rd
===================================================================
--- pkg/CHNOSZ/man/mix.Rd	2026-01-05 07:51:47 UTC (rev 947)
+++ pkg/CHNOSZ/man/mix.Rd	2026-01-06 06:10:46 UTC (rev 948)
@@ -88,7 +88,7 @@
 ad <- rebalance(dFe, dCu)
 diagram(ad, xlab = xlab, balance = 1, main = "Cu-Fe-S-O-H with rebalance()")
 db <- describe.basis(3)
-leg <- lex(lTP(400, 2000), db)
+leg <- c(lTP(400, 2000), db)
 legend("bottomleft", legend = leg, bty = "n")
 \dontshow{par(opar)}}
 

Modified: pkg/CHNOSZ/man/solubility.Rd
===================================================================
--- pkg/CHNOSZ/man/solubility.Rd	2026-01-05 07:51:47 UTC (rev 947)
+++ pkg/CHNOSZ/man/solubility.Rd	2026-01-06 06:10:46 UTC (rev 948)
@@ -118,7 +118,7 @@
 S_ <- expr.species("SO2", "gas", -20, TRUE)
 pH_ <- quote(pH == 6)
 T_ <- lT(125)
-lexpr <- lex(S_, pH_, T_)
+lexpr <- c(S_, pH_, T_)
 
 # Make diagrams from the results of solubility calculations
 layout(matrix(c(1, 3, 2, 3), nrow = 2))

Modified: pkg/CHNOSZ/man/stack_mosaic.Rd
===================================================================
--- pkg/CHNOSZ/man/stack_mosaic.Rd	2026-01-05 07:51:47 UTC (rev 947)
+++ pkg/CHNOSZ/man/stack_mosaic.Rd	2026-01-06 06:10:46 UTC (rev 948)
@@ -92,7 +92,7 @@
   species1, species2, species12, dx = dx,
   pH = pH, O2 = O2, T = T, P = P, IS = NaCl$IS)
 # Add legend and title
-lTP <- lex(lTP(T, P))
+lTP <- lTP(T, P)
 db <- describe.basis(c(3:4))
 legend("topright", c(lTP, db), bg = "white")
 title("Fe-Cu-S-O-H-Cl", font.main = 1)

Modified: pkg/CHNOSZ/man/util.legend.Rd
===================================================================
--- pkg/CHNOSZ/man/util.legend.Rd	2026-01-05 07:51:47 UTC (rev 947)
+++ pkg/CHNOSZ/man/util.legend.Rd	2026-01-06 06:10:46 UTC (rev 948)
@@ -6,7 +6,6 @@
 \alias{lT}
 \alias{lP}
 \alias{lTP}
-\alias{lex}
 \title{Functions to make legend text}
 \description{Generate expressions describing system conditions that can be added to legends of plots.}
 
@@ -16,7 +15,6 @@
   lT(x, digits = 0)
   lP(x, digits = 0)
   lTP(x, y, digits = 0)
-  lex(...)
 }
 
 \arguments{
@@ -23,7 +21,6 @@
   \item{x}{numeric, value of the property}
   \item{digits}{numeric, digits for rounding}
   \item{y}{numeric, value of pressure}
-  \item{...}{language, objects to combine in an expression}
 }
 
 \details{
@@ -31,9 +28,6 @@
 \code{lNaCl} describe the molality of NaCl, and \code{lS} the total molality of sulfur.
 \code{lT} and \code{lP} describe the temperature and pressure.
 \code{lTP} describe the temperature and pressure together, separated by a comma.
-
-The above functions return language objects, which can be combined with \code{lex} to make an expression that when used in \code{\link{legend}} appears on multiple lines.
-
 }
 
 \seealso{
@@ -42,8 +36,8 @@
 
 \examples{
 plot.new()
-l <- lex(lTP(100, "Psat"), lNaCl(1), lS(1e-3))
-legend("center", l)
+l <- c(lTP(100, "Psat"), lNaCl(1), lS(1e-3))
+legend("center", legend = l)
 }
 
 \concept{Utility functions}

Modified: pkg/CHNOSZ/vignettes/anintro.Rmd
===================================================================
--- pkg/CHNOSZ/vignettes/anintro.Rmd	2026-01-05 07:51:47 UTC (rev 947)
+++ pkg/CHNOSZ/vignettes/anintro.Rmd	2026-01-06 06:10:46 UTC (rev 948)
@@ -457,8 +457,7 @@
   lNaCl(1.9),
   lS(Stot)
 )
-leg_expr <- lex(leg_list)
-legend("bottomleft", legend = leg_expr, bg = "white")
+legend("bottomleft", legend = leg_list, bg = "white")
 title("Total solubility is higher than quasisolubility", font.main = 1)
 
 ## Second plot: activities of aqueous species in solubility calculation
@@ -820,8 +819,7 @@
   lNaCl(m_NaCl),
   lS(Stot)
 )
-leg_expr <- lex(leg_list)
-legend("topright", legend = leg_expr, bty = "n")
+legend("topright", legend = leg_list, bty = "n")
 
 # Make diagram for aqueous species
 species(iaq)

Modified: pkg/CHNOSZ/vignettes/multi-metal.Rmd
===================================================================
--- pkg/CHNOSZ/vignettes/multi-metal.Rmd	2026-01-05 07:51:47 UTC (rev 947)
+++ pkg/CHNOSZ/vignettes/multi-metal.Rmd	2026-01-06 06:10:46 UTC (rev 948)
@@ -993,7 +993,7 @@
 label.plot("E")
 
 db <- describe.basis(3)
-leg <- lex(lTP(400, 2000), db)
+leg <- c(lTP(400, 2000), db)
 legend("bottomleft", legend = leg, bty = "n")
 ```
 </div>



More information about the CHNOSZ-commits mailing list