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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Sep 16 13:09:40 CEST 2014


Author: mvkorpel
Date: 2014-09-16 13:09:39 +0200 (Tue, 16 Sep 2014)
New Revision: 897

Modified:
   pkg/dplR/ChangeLog
   pkg/dplR/DESCRIPTION
   pkg/dplR/R/chron.R
   pkg/dplR/R/helpers.R
   pkg/dplR/man/chron.Rd
Log:
Pass-through of ... arguments from chron() to ar.func() and further to ar()


Modified: pkg/dplR/ChangeLog
===================================================================
--- pkg/dplR/ChangeLog	2014-05-30 09:16:42 UTC (rev 896)
+++ pkg/dplR/ChangeLog	2014-09-16 11:09:39 UTC (rev 897)
@@ -18,6 +18,11 @@
 
 - New Imported package: png.
 
+File: chron.R
+-------------
+
+- Added pass-through of arguments from chron() to ar()
+
 Files: corr.rwl.seg.R, corr.series.seg.R, interseries.cor.R,
        rwi.stats.running.R, xskel.ccf.plot.R, xskel.plot.R
 ------------------------------------------------------------

Modified: pkg/dplR/DESCRIPTION
===================================================================
--- pkg/dplR/DESCRIPTION	2014-05-30 09:16:42 UTC (rev 896)
+++ pkg/dplR/DESCRIPTION	2014-09-16 11:09:39 UTC (rev 897)
@@ -3,7 +3,7 @@
 Type: Package
 Title: Dendrochronology Program Library in R
 Version: 1.6.1
-Date: 2014-05-30
+Date: 2014-09-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", "trl")), person("Franco", "Biondi",

Modified: pkg/dplR/R/chron.R
===================================================================
--- pkg/dplR/R/chron.R	2014-05-30 09:16:42 UTC (rev 896)
+++ pkg/dplR/R/chron.R	2014-09-16 11:09:39 UTC (rev 897)
@@ -1,5 +1,5 @@
 `chron` <-
-    function(x, prefix="xxx", biweight=TRUE, prewhiten=FALSE)
+    function(x, prefix="xxx", biweight=TRUE, prewhiten=FALSE, ...)
 {
     prefix.str <- as.character(prefix)
     if (length(prefix.str) != 1 || nchar(prefix.str) > 3) {
@@ -12,7 +12,7 @@
         std <- apply(x, 1, tbrm, C=9)
     }
     if (prewhiten) {
-        x.ar <- apply(x, 2, ar.func)
+        x.ar <- apply(x, 2, ar.func, ...)
         if (!biweight) {
             res <- rowMeans(x.ar, na.rm=TRUE)
         } else {

Modified: pkg/dplR/R/helpers.R
===================================================================
--- pkg/dplR/R/helpers.R	2014-05-30 09:16:42 UTC (rev 896)
+++ pkg/dplR/R/helpers.R	2014-09-16 11:09:39 UTC (rev 897)
@@ -82,10 +82,10 @@
 }
 
 ### AR function for chron, normalize1, normalize.xdate, ...
-ar.func <- function(x, model = FALSE) {
+ar.func <- function(x, model = FALSE, ...) {
     y <- x
     idx.goody <- !is.na(y)
-    ar1 <- ar(y[idx.goody])
+    ar1 <- ar(y[idx.goody], ...)
     y[idx.goody] <- ar1$resid+ar1$x.mean
     if (isTRUE(model)) {
         structure(y, model = ar1)

Modified: pkg/dplR/man/chron.Rd
===================================================================
--- pkg/dplR/man/chron.Rd	2014-05-30 09:16:42 UTC (rev 896)
+++ pkg/dplR/man/chron.Rd	2014-09-16 11:09:39 UTC (rev 897)
@@ -7,7 +7,7 @@
   \code{\link{detrend}}.
 }
 \usage{
-chron(x, prefix = "xxx", biweight = TRUE, prewhiten = FALSE)
+chron(x, prefix = "xxx", biweight = TRUE, prewhiten = FALSE, \dots)
 }
 \arguments{
   \item{x}{a \code{data.frame} of ring widths with
@@ -20,11 +20,14 @@
     mean is calculated using \code{\link{tbrm}.}}
   \item{prewhiten}{\code{logical} flag. If \acronym{TRUE} each series is
     whitened using \code{\link{ar}} prior to averaging.}
+  \item{\dots}{Arguments passed to \code{\link{ar}} when
+    \code{prewhiten} is \code{TRUE}. For example, use \code{aic}
+    and \code{order.max} to control the order of the AR model.}
 }
 \details{
   This either averages the rows of the \code{data.frame} using a mean or
   a robust mean (the so-called standard chronology) or can do so from
-  the residuals of an ar process (the residual chronology).
+  the residuals of an AR process (the residual chronology).
 }
 \value{
   A \code{data.frame} with the standard chronology, residual chronology (if



More information about the Dplr-commits mailing list