[Dplr-commits] r720 - in pkg/dplR: . R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jan 13 10:36:33 CET 2014


Author: mvkorpel
Date: 2014-01-13 10:36:33 +0100 (Mon, 13 Jan 2014)
New Revision: 720

Modified:
   pkg/dplR/ChangeLog
   pkg/dplR/DESCRIPTION
   pkg/dplR/R/exactmean.R
   pkg/dplR/R/gini.coef.R
   pkg/dplR/R/sens1.R
   pkg/dplR/R/sens2.R
Log:
Fixed other instances of the same "binding of NaN changed" bug.


Modified: pkg/dplR/ChangeLog
===================================================================
--- pkg/dplR/ChangeLog	2014-01-12 01:31:43 UTC (rev 719)
+++ pkg/dplR/ChangeLog	2014-01-13 09:36:33 UTC (rev 720)
@@ -4,44 +4,17 @@
 ---------------
 - Improved (slightly) the trbm() examples.
 
+Files: exactmean.R, gini.coef.R, sens1.R, sens2.R, tbrm.R
+---------------------------------------------------------
 
-File: tbrm.R
----------------
+- Changed calls to .C (where we use DUP = FALSE) so that the
+  binding of NaN will not change, fixing multiple instances of a bug
+  in dplR code revealed by changes in recent R development versions.
+  We were accidentally breaking CRAN's "malicious or anti-social"
+  policy. Thanks to Professor Brian D. Ripley for reporting.
 
-- Changed tbrm call to .C so that it doesn't
-  break CRAN's anti-social policy. Email from
-  BDR details error.
-  Begin quote from Ripley:
-  The error is in your function tbrm:
-  
-  > tbrm
-  function (x, C = 9)
-  {
-       y <- as.double(x[!is.na(x)])
-       n <- as.integer(length(y))
-       stopifnot(!is.na(n))
-       .C(dplR.tbrm,
-          y, n, as.double(C), result = NaN, NAOK = TRUE, DUP = FALSE)$result
-  }
-  
-  That .C call changes its arguments: see the warnings in ?.C .  In this
-  case it changes the binding of NaN.
-  
-  You could remove DUP = FALSE (these days it is not helping) or use
-  
-  > tbrm
-  function (x, C = 9)
-  {
-       y <- as.double(x[!is.na(x)])
-       n <- as.integer(length(y))
-       stopifnot(!is.na(n))
-       .C(dplR.tbrm, y, n, as.double(C), result = double(1L), NAOK = TRUE,
-           DUP = FALSE)$result
-  }
-  End quote from Ripley
-  This change was made and R CMD check --as-cran passes fine.
+  Now R CMD check --as-cran passes fine.
 
-
 File: DESCRIPTION
 
 - Added Jacob Cecile as a contributor

Modified: pkg/dplR/DESCRIPTION
===================================================================
--- pkg/dplR/DESCRIPTION	2014-01-12 01:31:43 UTC (rev 719)
+++ pkg/dplR/DESCRIPTION	2014-01-13 09:36:33 UTC (rev 720)
@@ -3,7 +3,7 @@
 Type: Package
 Title: Dendrochronology Program Library in R
 Version: 1.5.8
-Date: 2013-11-27
+Date: 2014-01-13
 Authors at R: c(person("Andy", "Bunn", role = c("aut", "cph",
         "cre", "trl"), email = "andy.bunn at wwu.edu"), person("Mikko",
         "Korpela", role = c("aut", "trl")), person("Franco", "Biondi",

Modified: pkg/dplR/R/exactmean.R
===================================================================
--- pkg/dplR/R/exactmean.R	2014-01-12 01:31:43 UTC (rev 719)
+++ pkg/dplR/R/exactmean.R	2014-01-13 09:36:33 UTC (rev 720)
@@ -5,5 +5,5 @@
     n <- as.integer(length(y))
     stopifnot(!is.na(n))
     .C(dplR.mean,
-       y, n, result=NaN, NAOK=TRUE, DUP=FALSE)$result
+       y, n, result=NaN*double(1L), NAOK=TRUE, DUP=FALSE)$result
 }

Modified: pkg/dplR/R/gini.coef.R
===================================================================
--- pkg/dplR/R/gini.coef.R	2014-01-12 01:31:43 UTC (rev 719)
+++ pkg/dplR/R/gini.coef.R	2014-01-13 09:36:33 UTC (rev 720)
@@ -4,5 +4,5 @@
     n <- as.integer(length(y))
     stopifnot(!is.na(n))
     .C(dplR.gini,
-       y, n, result=NaN, NAOK=TRUE, DUP=FALSE)$result
+       y, n, result=double(1L), NAOK=TRUE, DUP=FALSE)$result
 }

Modified: pkg/dplR/R/sens1.R
===================================================================
--- pkg/dplR/R/sens1.R	2014-01-12 01:31:43 UTC (rev 719)
+++ pkg/dplR/R/sens1.R	2014-01-13 09:36:33 UTC (rev 720)
@@ -4,5 +4,5 @@
     n <- as.integer(length(y))
     stopifnot(!is.na(n))
     .C(dplR.sens1,
-       y, n, result=NaN, NAOK=TRUE, DUP=FALSE)$result
+       y, n, result=NaN*double(1L), NAOK=TRUE, DUP=FALSE)$result
 }

Modified: pkg/dplR/R/sens2.R
===================================================================
--- pkg/dplR/R/sens2.R	2014-01-12 01:31:43 UTC (rev 719)
+++ pkg/dplR/R/sens2.R	2014-01-13 09:36:33 UTC (rev 720)
@@ -4,5 +4,5 @@
     n <- as.integer(length(y))
     stopifnot(!is.na(n))
     .C(dplR.sens2,
-       y, n, result=NaN, NAOK=TRUE, DUP=FALSE)$result
+       y, n, result=NaN*double(1L), NAOK=TRUE, DUP=FALSE)$result
 }



More information about the Dplr-commits mailing list