[CHNOSZ-commits] r106 - in pkg/CHNOSZ: . R inst
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Feb 17 16:33:18 CET 2016
Author: jedick
Date: 2016-02-17 16:33:17 +0100 (Wed, 17 Feb 2016)
New Revision: 106
Modified:
pkg/CHNOSZ/DESCRIPTION
pkg/CHNOSZ/R/makeup.R
pkg/CHNOSZ/inst/NEWS
Log:
makeup() works even if 'thermo' is not loaded
Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION 2016-01-09 04:28:41 UTC (rev 105)
+++ pkg/CHNOSZ/DESCRIPTION 2016-02-17 15:33:17 UTC (rev 106)
@@ -1,6 +1,6 @@
-Date: 2016-01-09
+Date: 2016-02-17
Package: CHNOSZ
-Version: 1.0.7-3
+Version: 1.0.7-4
Title: Chemical Thermodynamics and Activity Diagrams
Author: Jeffrey Dick
Maintainer: Jeffrey Dick <j3ffdick at gmail.com>
Modified: pkg/CHNOSZ/R/makeup.R
===================================================================
--- pkg/CHNOSZ/R/makeup.R 2016-01-09 04:28:41 UTC (rev 105)
+++ pkg/CHNOSZ/R/makeup.R 2016-02-17 15:33:17 UTC (rev 106)
@@ -220,10 +220,13 @@
}
return(out)
}
- # if the formula argument is numeric, get the formula
- # of that species number in thermo$obigt
- thermo <- get("thermo")
- if(is.numeric(formula)) formula <- thermo$obigt$formula[formula]
+ # if the formula argument is numeric,
+ # and if the thermo object is available,
+ # get the formula of that numbered species from thermo$obigt
+ if("CHNOSZ" %in% search()) {
+ thermo <- get("thermo", "CHNOSZ")
+ if(is.numeric(formula)) formula <- thermo$obigt$formula[formula]
+ }
# first deal with charge
cc <- count.charge(formula)
# count.elements doesn't know about charge so we need
@@ -248,9 +251,11 @@
# all done with the counting, now apply the multiplier
out <- out * multiplier
# complain if there are any elements that look strange
- are.elements <- names(out) %in% thermo$element$element
- if(!all(are.elements)) warning(paste("element(s) not in thermo$element:",
- paste(rownames(out)[!are.elements], collapse=" ") ))
+ if("CHNOSZ" %in% search()) {
+ are.elements <- names(out) %in% thermo$element$element
+ if(!all(are.elements)) warning(paste("element(s) not in thermo$element:",
+ paste(rownames(out)[!are.elements], collapse=" ") ))
+ }
# done!
return(out)
}
Modified: pkg/CHNOSZ/inst/NEWS
===================================================================
--- pkg/CHNOSZ/inst/NEWS 2016-01-09 04:28:41 UTC (rev 105)
+++ pkg/CHNOSZ/inst/NEWS 2016-02-17 15:33:17 UTC (rev 106)
@@ -1,4 +1,4 @@
-CHANGES IN CHNOSZ 1.0.7-3 (2016-01-09)
+CHANGES IN CHNOSZ 1.0.7-4 (2016-02-17)
--------------------------------------
- Add gypsum to OBIGT.csv.
@@ -19,6 +19,9 @@
- Use given/family naming scheme in inst/CITATION.
+- makeup() now works even if 'thermo' object is not available (useful
+ for other packages importing this function).
+
CHANGES IN CHNOSZ 1.0.7 (2015-11-19)
------------------------------------
More information about the CHNOSZ-commits
mailing list