[Dplr-commits] r828 - pkg/dplR/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Apr 21 20:57:43 CEST 2014
Author: mvkorpel
Date: 2014-04-21 20:57:43 +0200 (Mon, 21 Apr 2014)
New Revision: 828
Modified:
pkg/dplR/R/detrend.series.R
Log:
* SIMPLIFY=TRUE added to mapply() (model.info was broken)
* Internal variable stats renamed to modelStats
Modified: pkg/dplR/R/detrend.series.R
===================================================================
--- pkg/dplR/R/detrend.series.R 2014-04-21 17:48:30 UTC (rev 827)
+++ pkg/dplR/R/detrend.series.R 2014-04-21 18:57:43 UTC (rev 828)
@@ -84,7 +84,7 @@
y2[y2 == 0] <- 0.001
resids <- list()
- stats <- list()
+ modelStats <- list()
if("ModNegExp" %in% method2){
## Nec or lm
@@ -222,7 +222,7 @@
mneStats <- NULL
}
resids$ModNegExp <- y2 / ModNegExp
- stats$ModNegExp <- mneStats
+ modelStats$ModNegExp <- mneStats
do.mne <- TRUE
} else {
do.mne <- FALSE
@@ -254,7 +254,7 @@
splineStats <- list(method = "Spline", nyrs = nyrs2)
}
resids$Spline <- y2 / Spline
- stats$Spline <- splineStats
+ modelStats$Spline <- splineStats
do.spline <- TRUE
} else {
do.spline <- FALSE
@@ -272,7 +272,7 @@
}
meanStats <- list(method = "Mean", mean = theMean)
resids$Mean <- y2 / Mean
- stats$Mean <- meanStats
+ modelStats$Mean <- meanStats
do.mean <- TRUE
} else {
do.mean <- FALSE
@@ -298,7 +298,7 @@
Ar[Ar<0] <- 0
}
resids$Ar <- Ar / mean(Ar,na.rm=TRUE)
- stats$Ar <- arStats
+ modelStats$Ar <- arStats
do.ar <- TRUE
} else {
do.ar <- FALSE
@@ -308,11 +308,12 @@
if (verbose || return.info) {
zero.years <- lapply(resids, zeroFun)
n.zeros <- lapply(zero.years, nFun)
- stats <- mapply(c, stats, n.zeros, zero.years)
+ modelStats <- mapply(c, modelStats, n.zeros, zero.years,
+ SIMPLIFY = FALSE)
if (verbose) {
n.zeros2 <- unlist(n.zeros, use.names = FALSE)
zeroFlag <- n.zeros2 > 0
- methodNames <- names(stats)
+ methodNames <- names(modelStats)
if (any(zeroFlag)) {
cat("", sepLine, sep = "\n")
for (i in which(zeroFlag)) {
@@ -398,7 +399,7 @@
if(!is.data.frame(resids2)) names(resids2) <- names(y)
if (return.info) {
list(series = resids2,
- model.info = stats[method2], data.info = dataStats)
+ model.info = modelStats[method2], data.info = dataStats)
} else {
resids2
}
More information about the Dplr-commits
mailing list