[CHNOSZ-commits] r269 - in pkg/CHNOSZ: . R man man/macros

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Oct 29 06:49:01 CET 2017


Author: jedick
Date: 2017-10-29 06:49:00 +0100 (Sun, 29 Oct 2017)
New Revision: 269

Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/R/examples.R
   pkg/CHNOSZ/man/examples.Rd
   pkg/CHNOSZ/man/macros/macros.Rd
Log:
use save.png argument name in examples() and demos()


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2017-10-27 14:49:32 UTC (rev 268)
+++ pkg/CHNOSZ/DESCRIPTION	2017-10-29 05:49:00 UTC (rev 269)
@@ -1,6 +1,6 @@
-Date: 2017-10-27
+Date: 2017-10-29
 Package: CHNOSZ
-Version: 1.1.0-67
+Version: 1.1.0-68
 Title: Thermodynamic Calculations for Geobiochemistry
 Author: Jeffrey Dick
 Maintainer: Jeffrey Dick <j3ffdick at gmail.com>

Modified: pkg/CHNOSZ/R/examples.R
===================================================================
--- pkg/CHNOSZ/R/examples.R	2017-10-27 14:49:32 UTC (rev 268)
+++ pkg/CHNOSZ/R/examples.R	2017-10-29 05:49:00 UTC (rev 269)
@@ -2,7 +2,7 @@
 # run examples from the help files, 
 # and a function containing extra examples
 
-examples <- function(do.png=FALSE) {
+examples <- function(save.png=FALSE) {
   # run all the examples in CHNOSZ documentation
   .ptime <- proc.time()
   topics <- c("thermo", "examples",
@@ -13,37 +13,37 @@
     "diagram", "buffer", "nonideal", "add.protein", "protein", "ionize.aa", "yeast.aa",
     "anim", "objective", "revisit", "EOSregress", "wjd")
   plot.it <- FALSE
-  if(is.character(do.png))
-    png(paste(do.png,"%d.png",sep=""),width=500,height=500,pointsize=12)
-  else if(do.png) plot.it <- TRUE
+  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(do.png)) dev.off()
+  if(is.character(save.png)) dev.off()
   cat("Time elapsed: ", proc.time() - .ptime, "\n")
 }
 
 demos <- function(which=c("sources", "protein.equil", "affinity", "NaCl", "density", 
   "ORP", "revisit", "findit", "ionize", "buffer", "protbuff", "yeastgfp", "mosaic",
   "copper", "solubility", "wjd", "dehydration", "bugstab", "Shh", "activity_ratios",
-  "adenine", "DEW", "lambda", "TCA"), to.file=FALSE) {
+  "adenine", "DEW", "lambda", "TCA"), save.png=FALSE) {
   # run one or more demos from CHNOSZ with ask=FALSE, and return the value of the last one
   for(i in 1:length(which)) {
     # say something so the user sees where we are
     message("------------")
-    if(which[i]=="dehydration" & !to.file) {
-      message("demos: skipping dehydration demo as to.file is FALSE")
+    if(which[i]=="dehydration" & !save.png) {
+      message("demos: skipping dehydration demo as save.png is FALSE")
       next 
     } else message(paste("demos: running '", which[i], "'", sep=""))
-    if(to.file & !which[i]=="dehydration") {
+    if(save.png & !which[i]=="dehydration") {
       if(which[i]=="bugstab") png(paste(which[i], "%d.png", sep=""), width=700, height=500, pointsize=12)
       else png(paste(which[i], "%d.png", sep=""), width=500, height=500, pointsize=12)
     }
     out <- demo(which[i], package="CHNOSZ", character.only=TRUE, echo=FALSE, ask=FALSE)
-    if(to.file & !which[i]=="dehydration") dev.off()
+    if(save.png & !which[i]=="dehydration") dev.off()
   }
   return(invisible(out))
 }

Modified: pkg/CHNOSZ/man/examples.Rd
===================================================================
--- pkg/CHNOSZ/man/examples.Rd	2017-10-27 14:49:32 UTC (rev 268)
+++ pkg/CHNOSZ/man/examples.Rd	2017-10-29 05:49:00 UTC (rev 269)
@@ -7,26 +7,24 @@
   Run the examples contained in each of the documentation topics. }
 
 \arguments{
-  \item{do.png}{logical, generate PNG files for the plots?}
+  \item{save.png}{logical, generate PNG image files for the plots?}
   \item{which}{character, which example to run}
-  \item{to.file}{logical, generate image files for the plots?}
 }
 
 \usage{
-  examples(do.png = FALSE)
+  examples(save.png = FALSE)
   demos(which = c("sources", "protein.equil", "affinity", "NaCl",
     "density", "ORP", "revisit", "findit", "ionize", "buffer",
     "protbuff", "yeastgfp", "mosaic", "copper", "solubility",
     "wjd", "dehydration", "bugstab", "Shh", "activity_ratios",
     "adenine", "DEW", "lambda", "TCA"),
-    to.file=FALSE)
+    save.png=FALSE)
 }
 
 \details{
 
 \code{examples} runs all the examples in the documentation 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).
-If \code{do.png} is TRUE, the plots in the examples are saved as \code{\link{png}} files having names beginning with the name of each of the help topics.
 
 \code{demos} is a function to run other examples that are provided as \code{\link{demo}s}.
 \code{\link{demo}} is called with settings to not echo the source code and to not ask before making each plot.
@@ -46,7 +44,7 @@
     \code{ionize} \tab ionize.aa(): contour plots of net charge and ionization properties of LYSC_CHICK \cr
     \code{buffer} \tab  * Minerals and aqueous species as buffers of hydrogen fugacity (Schulte and Shock, 1995) \cr
     \code{protbuff} \tab Chemical activities buffered by thiol peroxidases or sigma factors \cr
-    \code{yeastgfp} \tab * Subcellular locations: log fO2 - log aH2O and log a - log fO2 diagrams (Dick, 2009) \cr
+    \code{yeastgfp} \tab * Subcellular locations: \logfO2 - \logaH2O and \loga - \logfO2 diagrams (Dick, 2009) \cr
     \code{mosaic} \tab * Eh-pH diagram with two sets of changing basis species (Garrels and Christ, 1965) \cr
     \code{copper} \tab * Another example of \code{\link{mosaic}}: complexation of Cu with glycine (Aksu and Doyle, 2001) \cr
     \code{solubility} \tab * Solubility of calcite (cf. Manning et al., 2013) or \CO2 (cf. Stumm and Morgan, 1996) \cr
@@ -62,6 +60,8 @@
     \code{go-IU} \tab * Diagrams using thermodynamic data in the SUPCRTBL compilation (Zimmer et al., 2016) \cr
   }
 
+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.
+
 }
 
 \references{

Modified: pkg/CHNOSZ/man/macros/macros.Rd
===================================================================
--- pkg/CHNOSZ/man/macros/macros.Rd	2017-10-27 14:49:32 UTC (rev 268)
+++ pkg/CHNOSZ/man/macros/macros.Rd	2017-10-29 05:49:00 UTC (rev 269)
@@ -25,6 +25,7 @@
 \newcommand{\logfO2}{\ifelse{latex}{\eqn{\log f_{\mathrm{O_{2}}}}}{\ifelse{html}{\out{log<i>f</i><sub>O<sub>2</sub></sub>}}{logfO2}}}
 \newcommand{\logfH2}{\ifelse{latex}{\eqn{\log f_{\mathrm{H_{2}}}}}{\ifelse{html}{\out{log<i>f</i><sub>H<sub>2</sub></sub>}}{logfH2}}}
 \newcommand{\logaH2O}{\ifelse{latex}{\eqn{\log a_{\mathrm{H_{2}O}}}}{\ifelse{html}{\out{log<i>a</i><sub>H<sub>2</sub>O</sub>}}{logaH2O}}}
+\newcommand{\loga}{\ifelse{latex}{\eqn{\log a}}{\ifelse{html}{\out{log<i>a</i>}}{log a}}}
 \newcommand{\ZC}{\ifelse{latex}{\eqn{Z_\mathrm{C}}}{\ifelse{html}{\out{<I>Z</I><sub>C</sub>}}{ZC}}}
 % use \nH2O{̄} to call this macro (the html code can't be defined in the macro,
 % which interprets '#' followed by a number as a placeholder for an argument)



More information about the CHNOSZ-commits mailing list