[Analogue-commits] r211 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Mar 14 15:37:50 CET 2011


Author: gsimpson
Date: 2011-03-14 15:37:48 +0100 (Mon, 14 Mar 2011)
New Revision: 211

Removed:
   pkg/R/wa.fit.R
Log:
rename wa.fit to waFit to avoid silly S3 methodness

Deleted: pkg/R/wa.fit.R
===================================================================
--- pkg/R/wa.fit.R	2011-03-13 22:32:15 UTC (rev 210)
+++ pkg/R/wa.fit.R	2011-03-14 14:37:48 UTC (rev 211)
@@ -1,34 +0,0 @@
-`wa.fit` <- function(x, y, tol.dw, useN2, deshrink, na.tol, small.tol,
-                     min.tol, f) {
-    ## calculate WA optima for each species in x
-    wa.optima <- w.avg(x, y)
-    ## compute tolerances
-    tolerances <- tol <- w.tol(x, y, wa.optima, useN2 = useN2)
-    ## fix-up tolerances for use in TF computations
-    if(small.tol == "fraction") {
-        if(!(f > 0 && f < 1))
-            stop("'f' must be 0 < f < 1")
-        frac <- f * diff(range(y))
-        if(frac < min.tol)
-            warning("Requested fraction of gradient is < minimum tolerance.")
-    }
-    tol <- fixUpTol(tol, na.tol = na.tol, small.tol = small.tol,
-                    min.tol = min.tol, f = f, env = y)
-    ## calculate WA estimate of env for each site
-    wa.env <- if(tol.dw) {
-        WATpred(x, wa.optima, tol, n.samp, n.spp)
-    } else {
-        WApred(x, wa.optima)
-    }
-    ## taken averages twice so deshrink
-    expanded <- deshrink(y, wa.env, type = deshrink)
-    wa.env <- expanded$env
-    coefficients <- coef(expanded)
-    ## returned object
-    res <- list(wa.optima = wa.optima,
-                tolerances = tolerances,
-                model.tol = tol,
-                fitted.values = wa.env,
-                coefficients = coefficients)
-    res
-}



More information about the Analogue-commits mailing list