[Analogue-commits] r156 - pkg/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Jan 16 17:53:24 CET 2010
Author: gsimpson
Date: 2010-01-16 17:53:24 +0100 (Sat, 16 Jan 2010)
New Revision: 156
Modified:
pkg/R/wa.R
Log:
tidying code in wa.R
Modified: pkg/R/wa.R
===================================================================
--- pkg/R/wa.R 2010-01-16 13:50:40 UTC (rev 155)
+++ pkg/R/wa.R 2010-01-16 16:53:24 UTC (rev 156)
@@ -1,11 +1,12 @@
`wa` <- function(x, ...) UseMethod("wa")
-`wa.default` <- function(x, env,
- deshrink = c("inverse", "classical", "expanded", "none"),
- tol.dw = FALSE, useN2 = TRUE,
- na.tol = c("min","mean","max"),
- small.tol = c("min","fraction","absolute"),
- min.tol = NULL, f = 0.1, ...)
+`wa.default` <-
+ function(x, env,
+ deshrink = c("inverse", "classical", "expanded", "none"),
+ tol.dw = FALSE, useN2 = TRUE,
+ na.tol = c("min","mean","max"),
+ small.tol = c("min","fraction","absolute"),
+ min.tol = NULL, f = 0.1, ...)
{
## x = species abundances (weights), env = response vector
x <- as.matrix(x)
@@ -40,10 +41,10 @@
tol <- fixUpTol(tol, na.tol = na.tol, small.tol = small.tol,
min.tol = min.tol, f = f, env = env)
## calculate WA estimate of env for each site
- if(tol.dw) {
- wa.env <- WATpred(x, wa.optima, tol, n.samp, n.spp)
+ wa.env <- if(tol.dw) {
+ WATpred(x, wa.optima, tol, n.samp, n.spp)
} else {
- wa.env <- WApred(x, wa.optima)
+ WApred(x, wa.optima)
}
## taken averages twice so deshrink
expanded <- deshrink(env, wa.env, type = deshrink)
More information about the Analogue-commits
mailing list