[CHNOSZ-commits] r522 - in pkg/CHNOSZ: . R inst man tests/testthat vignettes

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Mar 2 04:19:36 CET 2020


Author: jedick
Date: 2020-03-02 04:19:34 +0100 (Mon, 02 Mar 2020)
New Revision: 522

Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/R/add.protein.R
   pkg/CHNOSZ/inst/NEWS
   pkg/CHNOSZ/man/add.protein.Rd
   pkg/CHNOSZ/tests/testthat/test-add.protein.R
   pkg/CHNOSZ/vignettes/obigt.bib
Log:
test-add.protein.R: fix for new stringsAsFactors = FALSE default in R-devel


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2019-12-15 04:02:04 UTC (rev 521)
+++ pkg/CHNOSZ/DESCRIPTION	2020-03-02 03:19:34 UTC (rev 522)
@@ -1,6 +1,6 @@
-Date: 2019-12-15
+Date: 2020-03-02
 Package: CHNOSZ
-Version: 1.3.4
+Version: 1.3.5-1
 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.protein.R
===================================================================
--- pkg/CHNOSZ/R/add.protein.R	2019-12-15 04:02:04 UTC (rev 521)
+++ pkg/CHNOSZ/R/add.protein.R	2020-03-02 03:19:34 UTC (rev 522)
@@ -67,12 +67,7 @@
   # now we're ready to go
   tp.new <- thermo$protein
   if(!all(ipdup)) tp.new <- rbind(tp.new, aa[!ipdup, ])
-  if(any(ipdup)) {
-    if(any(sapply(1:4, function(i){is.factor(aa[, i])})))
-      stop(paste("converting factors causes problems replacing protein data",
-        "  data file should be read using e.g. aa <- read.csv(file, stringsAsFactors=FALSE)", sep="\n"))
-    tp.new[ip[ipdup], ] <- aa[ipdup, ]
-  }
+  if(any(ipdup)) tp.new[ip[ipdup], ] <- aa[ipdup, ]
   rownames(tp.new) <- NULL
   thermo$protein <- tp.new
   assign("thermo", thermo, CHNOSZ)

Modified: pkg/CHNOSZ/inst/NEWS
===================================================================
--- pkg/CHNOSZ/inst/NEWS	2019-12-15 04:02:04 UTC (rev 521)
+++ pkg/CHNOSZ/inst/NEWS	2020-03-02 03:19:34 UTC (rev 522)
@@ -1,3 +1,15 @@
+CHANGES IN CHNOSZ 1.3.5-1 (2020-03-02)
+--------------------------------------
+
+- Fix for R-devel: test-add.protein.R had a test that failed with new
+  stringsAsFactors = FALSE default for read.table().
+
+CHANGES IN CHNOSZ 1.3.5 (2020-02-16)
+------------------------------------
+
+- Fix for R-devel: remove documentation for unused argument '...' in
+  add.protein.Rd.
+
 CHANGES IN CHNOSZ 1.3.4 (2019-12-15)
 ------------------------------------
 

Modified: pkg/CHNOSZ/man/add.protein.Rd
===================================================================
--- pkg/CHNOSZ/man/add.protein.Rd	2019-12-15 04:02:04 UTC (rev 521)
+++ pkg/CHNOSZ/man/add.protein.Rd	2020-03-02 03:19:34 UTC (rev 522)
@@ -18,7 +18,6 @@
   \item{aa}{data frame, amino acid composition in the format of \code{thermo()$protein}}
   \item{protein}{character, name of protein; numeric, indices of proteins (rownumbers of \code{\link{thermo}$protein})}
   \item{sequence}{character, protein sequence}
-  \item{...}{additional arguments passed to \code{\link{read.csv}}}
   \item{abundance}{numeric, abundances of proteins}
   \item{average}{logical, return the weighted average of amino acid counts?}
   \item{organism}{character, name of organism}

Modified: pkg/CHNOSZ/tests/testthat/test-add.protein.R
===================================================================
--- pkg/CHNOSZ/tests/testthat/test-add.protein.R	2019-12-15 04:02:04 UTC (rev 521)
+++ pkg/CHNOSZ/tests/testthat/test-add.protein.R	2020-03-02 03:19:34 UTC (rev 522)
@@ -6,12 +6,12 @@
 test_that("add.protein works as expected", {
   # factors causing problems again ...
   f <- system.file("extdata/protein/DS11.csv", package="CHNOSZ")
-  aa <- read.csv(f)
+  aa <- read.csv(f, as.is = TRUE)
   # this adds the proteins
-  ip <- add.protein(aa)
+  ip1 <- add.protein(aa)
   # the replaces the proteins (with the same ones)
-  expect_error(ip <- add.protein(aa), "converting factors causes problems replacing protein data")
-  # ... should use read.csv(file, as.is=TRUE)
+  ip2 <- add.protein(aa)
+  expect_equal(ip1, ip2)
 })
 
 test_that("errors and messages occur in some circumstances", {

Modified: pkg/CHNOSZ/vignettes/obigt.bib
===================================================================
--- pkg/CHNOSZ/vignettes/obigt.bib	2019-12-15 04:02:04 UTC (rev 521)
+++ pkg/CHNOSZ/vignettes/obigt.bib	2020-03-02 03:19:34 UTC (rev 522)
@@ -561,7 +561,7 @@
   title     = {{T}hermodynamic {P}roperties of {M}inerals and {R}elated {S}ubstances at 298.15 {K} and 1 {B}ar ($10^5$ {P}ascals) {P}ressure and at {H}igher {T}emperatures},
   year      = {1978},
   series    = {Bulletin 1452},
-  url       = {http://pubs.er.usgs.gov/publication/b1452},
+  url       = {https://pubs.er.usgs.gov/publication/b1452},
 }
 
 @Article{SS98a,
@@ -1253,7 +1253,7 @@
   volume    = {76},
   number    = {3-4},
   pages     = {445--457},
-  url       = {http://pubs.er.usgs.gov/publication/70016664},
+  url       = {https://pubs.er.usgs.gov/publication/70016664},
 }
 
 @Article{BPAH07,



More information about the CHNOSZ-commits mailing list