[CHNOSZ-commits] r418 - in pkg/CHNOSZ: . R inst
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Mar 2 15:16:57 CET 2019
Author: jedick
Date: 2019-03-02 15:16:57 +0100 (Sat, 02 Mar 2019)
New Revision: 418
Modified:
pkg/CHNOSZ/DESCRIPTION
pkg/CHNOSZ/R/add.obigt.R
pkg/CHNOSZ/R/diagram.R
pkg/CHNOSZ/R/thermo.R
pkg/CHNOSZ/R/util.data.R
pkg/CHNOSZ/inst/NEWS
Log:
various fixes to maintain compatibility with R version 3.1.0
Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION 2019-03-02 11:01:02 UTC (rev 417)
+++ pkg/CHNOSZ/DESCRIPTION 2019-03-02 14:16:57 UTC (rev 418)
@@ -1,6 +1,6 @@
Date: 2019-03-02
Package: CHNOSZ
-Version: 1.3.0-2
+Version: 1.3.0-3
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/R/add.obigt.R
===================================================================
--- pkg/CHNOSZ/R/add.obigt.R 2019-03-02 11:01:02 UTC (rev 417)
+++ pkg/CHNOSZ/R/add.obigt.R 2019-03-02 14:16:57 UTC (rev 418)
@@ -128,7 +128,8 @@
if(length(isys)==1) file <- system.file(paste0("extdata/OBIGT/", sysfiles[isys]), package="CHNOSZ")
}
# read data from the file
- to2 <- read.csv(file, as.is=TRUE)
+ # we need explicit colClasses here to avoid automatic detection as character for long numeric values in R 3.1.0 20190302
+ to2 <- read.csv(file, as.is=TRUE, colClasses=c(rep("character", 7), rep("numeric", 13)))
# load only selected species if requested
if(!is.null(species)) {
idat <- match(species, to2$name)
Modified: pkg/CHNOSZ/R/diagram.R
===================================================================
--- pkg/CHNOSZ/R/diagram.R 2019-03-02 11:01:02 UTC (rev 417)
+++ pkg/CHNOSZ/R/diagram.R 2019-03-02 14:16:57 UTC (rev 418)
@@ -515,7 +515,8 @@
}
}
# https://stackoverflow.com/questions/34570860/adding-na-to-make-all-list-elements-equal-length 20181029
- lapply(linesout, `length<-`, max(lengths(linesout)))
+ # for compatibility with R 3.1.0, don't use lengths() here 20190302
+ lapply(linesout, `length<-`, max(sapply(linesout, length)))
}
## label plot function
plot.names <- function(out, xs, ys, xlim, ylim, names) {
Modified: pkg/CHNOSZ/R/thermo.R
===================================================================
--- pkg/CHNOSZ/R/thermo.R 2019-03-02 11:01:02 UTC (rev 417)
+++ pkg/CHNOSZ/R/thermo.R 2019-03-02 14:16:57 UTC (rev 418)
@@ -44,7 +44,8 @@
# need explicit "/" for Windows
sourcefiles <- paste0(OBIGTdir, "/", c(sources_aq, sources_cr, sources_liq, sources_gas), ".csv")
sourcefiles[!sources=="Berman_cr"] <- paste0(sourcefiles[!sources=="Berman_cr"], ".xz")
- datalist <- lapply(sourcefiles, read.csv, as.is=TRUE)
+ # we need explicit colClasses here to avoid automatic detection as character for long numeric values in R 3.1.0 20190302
+ datalist <- lapply(sourcefiles, read.csv, as.is=TRUE, colClasses=c(rep("character", 7), rep("numeric", 13)))
obigt <- do.call(rbind, datalist)
# also read references file
refs <- read.csv(file.path(OBIGTdir, "refs.csv"), as.is=TRUE)
Modified: pkg/CHNOSZ/R/util.data.R
===================================================================
--- pkg/CHNOSZ/R/util.data.R 2019-03-02 11:01:02 UTC (rev 417)
+++ pkg/CHNOSZ/R/util.data.R 2019-03-02 14:16:57 UTC (rev 418)
@@ -399,7 +399,7 @@
# and apply column names depending on the EOS
if(identical(state, "aq")) {
# species in the Akinfiev-Diamond model (AkDi) have NA for Z 20190219
- isAkDi <- is.na(obigt$z.T)
+ isAkDi <- is.na(obigt[, 20])
# remove scaling factors for the HKF species, but not for the AkDi species
# protect this by an if statement to workaround error in subassignment to empty subset of data frame in R < 3.6.0
# (https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17483) 20190302
Modified: pkg/CHNOSZ/inst/NEWS
===================================================================
--- pkg/CHNOSZ/inst/NEWS 2019-03-02 11:01:02 UTC (rev 417)
+++ pkg/CHNOSZ/inst/NEWS 2019-03-02 14:16:57 UTC (rev 418)
@@ -1,4 +1,4 @@
-CHANGES IN CHNOSZ 1.3.0-1 (2019-03-02)
+CHANGES IN CHNOSZ 1.3.0-3 (2019-03-02)
--------------------------------------
- Fix unexported function obigt2eos(), which was affected by "Assignment
@@ -7,6 +7,10 @@
caused errors in R-release (3.5.2) but not R-devel, when using info()
for species with the AkDi model.
+- Various fixes to maintain compatibility with R version 3.1.0 (don't
+ use lengths(), and provide explicit colClasses to read.csv() to avoid
+ automatic detection of character for long numeric values).
+
CHANGES IN CHNOSZ 1.3.0 (2019-02-26)
------------------------------------
More information about the CHNOSZ-commits
mailing list