[Dplr-commits] r1043 - pkg/dplR/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Dec 19 10:53:03 CET 2016


Author: zang
Date: 2016-12-19 10:53:03 +0100 (Mon, 19 Dec 2016)
New Revision: 1043

Modified:
   pkg/dplR/R/sea.R
Log:
resample only for subset of data where we get complete range of lags

Modified: pkg/dplR/R/sea.R
===================================================================
--- pkg/dplR/R/sea.R	2016-11-28 10:51:21 UTC (rev 1042)
+++ pkg/dplR/R/sea.R	2016-12-19 09:53:03 UTC (rev 1043)
@@ -32,8 +32,11 @@
     se.unscaled <- colMeans(se.unscaled.table, na.rm = TRUE)
     re.table <- matrix(NA_real_, ncol = m, nrow = resample)
     re.subtable <- matrix(NA_real_, ncol = m, nrow = n)
+    l <- length(rnames)
+    trim <- c(1:lag, (l - lag + 1):l)
+    rnames.red <- rnames[-trim]
     for (k in seq_len(resample)) {
-        rand.key <- sample(rnames, n, replace = TRUE)
+        rand.key <- sample(rnames.red, n, replace = TRUE)
         for (i in seq.n) {
             re.subtable[i, ] <-
                                x.scaled[as.character(rand.key[i] + yrs.base), ]



More information about the Dplr-commits mailing list