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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon May 19 20:50:06 CEST 2014


Author: mvkorpel
Date: 2014-05-19 20:50:06 +0200 (Mon, 19 May 2014)
New Revision: 889

Modified:
   pkg/dplR/ChangeLog
   pkg/dplR/R/corr.series.seg.R
Log:
Bug fix to corr.series.seg(). Andy: correct me if I'm wrong.

Modified: pkg/dplR/ChangeLog
===================================================================
--- pkg/dplR/ChangeLog	2014-05-19 14:57:15 UTC (rev 888)
+++ pkg/dplR/ChangeLog	2014-05-19 18:50:06 UTC (rev 889)
@@ -29,6 +29,12 @@
 
 - Performance optimization, including the use of dev.hold() and dev.flush()
 
+File: corr.series.seg.R
+-----------------------
+
+- Bug fix: Argument 'method' was not used for moving correlations.
+  Instead, the method used was always "spearman".
+
 File: latexify.R
 ----------------
 

Modified: pkg/dplR/R/corr.series.seg.R
===================================================================
--- pkg/dplR/R/corr.series.seg.R	2014-05-19 14:57:15 UTC (rev 888)
+++ pkg/dplR/R/corr.series.seg.R	2014-05-19 18:50:06 UTC (rev 889)
@@ -5,7 +5,7 @@
                             pcrit=0.05, make.plot = TRUE,
                             floor.plus1 = FALSE, ...) {
 
-    method <- match.arg(method)
+    method2 <- match.arg(method)
 
     ## Handle different types of 'series'
     tmp <- pick.rwl.series(rwl, series, series.yrs)
@@ -98,7 +98,7 @@
             bin.cor <- NA
             bin.pval <- NA
         } else {
-            tmp <- cor.test(series2[mask], master[mask], method = method,
+            tmp <- cor.test(series2[mask], master[mask], method = method2,
                             alternative = "greater")
             bin.cor <- tmp$estimate
             bin.pval <- tmp$p.val
@@ -107,7 +107,7 @@
         res.pval[j] <- bin.pval
     }
     ## overall correlation
-    tmp <- cor.test(series2, master, method = method,
+    tmp <- cor.test(series2, master, method = method2,
                     alternative = "greater")
     overall.cor[1] <- tmp$estimate
     overall.cor[2] <- tmp$p.val
@@ -116,7 +116,7 @@
     for (i in seq_len(nyrs - seg.length + 1)) {
         mask <- i:(i + seg.length - 1)
         tmp <- cor.test(series2[mask], master[mask],
-                        method = "spearman", alternative = "greater")
+                        method = method2, alternative = "greater")
         res.mcor[i + seg.lag, 1] <- tmp$estimate
         res.mcor[i + seg.lag, 2] <- tmp$p.val
     }



More information about the Dplr-commits mailing list