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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Dec 12 22:23:52 CET 2018


Author: andybunn
Date: 2018-12-12 22:23:51 +0100 (Wed, 12 Dec 2018)
New Revision: 1136

Modified:
   pkg/dplR/ChangeLog
   pkg/dplR/DESCRIPTION
   pkg/dplR/R/ccf.series.rwl.R
   pkg/dplR/man/ccf.series.rwl.Rd
Log:
adding arg to ccf.series.rwl

Modified: pkg/dplR/ChangeLog
===================================================================
--- pkg/dplR/ChangeLog	2018-11-08 20:14:01 UTC (rev 1135)
+++ pkg/dplR/ChangeLog	2018-12-12 21:23:51 UTC (rev 1136)
@@ -1,5 +1,11 @@
 * CHANGES IN dplR VERSION 1.7.0
 
+File: ccf.series.rwl.R and .Rd
+----------------
+
+- Added new argument to allow user to specify whether a series or master gets 
+  passed to ccf as x. The convention was screwy.
+
 File: xdate.floater.R and .Rd
 ----------------
 

Modified: pkg/dplR/DESCRIPTION
===================================================================
--- pkg/dplR/DESCRIPTION	2018-11-08 20:14:01 UTC (rev 1135)
+++ pkg/dplR/DESCRIPTION	2018-12-12 21:23:51 UTC (rev 1136)
@@ -3,7 +3,7 @@
 Type: Package
 Title: Dendrochronology Program Library in R
 Version: 1.7.0
-Date: 2018-11-03
+Date: 2018-12-12
 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", "cph", "trl")), person("Franco", "Biondi",

Modified: pkg/dplR/R/ccf.series.rwl.R
===================================================================
--- pkg/dplR/R/ccf.series.rwl.R	2018-11-08 20:14:01 UTC (rev 1135)
+++ pkg/dplR/R/ccf.series.rwl.R	2018-12-12 21:23:51 UTC (rev 1136)
@@ -3,7 +3,7 @@
                            seg.length = 50, bin.floor = 100, n = NULL,
                            prewhiten = TRUE, biweight = TRUE,
                            pcrit = 0.05, lag.max = 5, make.plot = TRUE,
-                           floor.plus1 = FALSE, ...) {
+                           floor.plus1 = FALSE, series.x, ...) {
 
     ## Handle different types of 'series'
     tmp <- pick.rwl.series(rwl, series, series.yrs)
@@ -79,8 +79,15 @@
             bin.ccf <- NA
         }
         else {
-            tmp <- ccf(series2[mask], master[mask], lag.max=lag.max,
+            if(series.x){
+              tmp <- ccf(x = series2[mask], y = master[mask], lag.max=lag.max,
+                         plot=FALSE)  
+            }
+          else {
+            tmp <- ccf(x = master[mask], y = series2[mask], lag.max=lag.max,
                        plot=FALSE)
+          }
+            
             bin.ccf <- as.vector(tmp$acf)
         }
         res.cor[, j] <- bin.ccf

Modified: pkg/dplR/man/ccf.series.rwl.Rd
===================================================================
--- pkg/dplR/man/ccf.series.rwl.Rd	2018-11-08 20:14:01 UTC (rev 1135)
+++ pkg/dplR/man/ccf.series.rwl.Rd	2018-12-12 21:23:51 UTC (rev 1136)
@@ -11,7 +11,7 @@
                seg.length = 50, bin.floor = 100, n = NULL,
                prewhiten = TRUE, biweight = TRUE, pcrit = 0.05,
                lag.max = 5, make.plot = TRUE,
-               floor.plus1 = FALSE, \dots)
+               floor.plus1 = FALSE, series.x = FALSE, \dots)
 }
 \arguments{
   \item{rwl}{ a \code{data.frame} with series as columns and years as rows
@@ -46,6 +46,8 @@
   \item{floor.plus1}{ \code{logical} flag.  If \code{TRUE}, one year is
     added to the base location of the first segment (e.g., 1601, 1701,
     1801 \acronym{AD}). }
+  \item{series.x}{ \code{logical} flag indicating whether to make the \code{series}
+    the \code{x} argument to \code{\link{ccf}}. See Details. }
   \item{\dots}{ other arguments passed to plot. }
 }
 \details{
@@ -59,12 +61,13 @@
   
   The cross correlations are calculated calling
   \code{\link{ccf}} as \cr
-  \code{ccf(x=series, y=master, lag.max=lag.max, plot=FALSE)}.  Note that
-  prior to dplR version 1.60, the \code{master} was set as \code{x} and 
-  the \code{series} as \code{y}.  This was changed to be more in line with 
-  user expectations so that a missing ring in a series produces a positive
-  lag in the plot rather than a negative lag.  This structure of this call
-  does put the plots at odds with Figure 3 in Bunn (2010) which is unfortunate.
+  \code{ccf(x=master, y=series, lag.max=lag.max, plot=FALSE)} if \code{series.x} is 
+  \code{FALSE} and as \code{ccf(x=series, y=master, lag.max=lag.max, plot=FALSE)} if 
+  \code{series.x} is \code{TRUE}.  This argument was introduced in dplR version 1.7.0.
+  
+  Different users have different expectations about how missing or extra rings are 
+  notated. If \code{switch.x = FALSE} the behavior will be like COFECHA where a missing 
+  ring in a series produces a negative lag in the plot rather than a positive lag.
 
   Correlations are calculated for the first segment, then the
   second segment and so on.  Correlations are only calculated for segments with



More information about the Dplr-commits mailing list