[Vegan-commits] r1027 - in pkg/vegan: R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Oct 3 07:52:20 CEST 2009


Author: jarioksa
Date: 2009-10-03 07:52:20 +0200 (Sat, 03 Oct 2009)
New Revision: 1027

Added:
   pkg/vegan/R/scores.lda.R
Modified:
   pkg/vegan/inst/ChangeLog
   pkg/vegan/man/scores.Rd
Log:
added scores.lda so that ordiplot() works with lda results

Added: pkg/vegan/R/scores.lda.R
===================================================================
--- pkg/vegan/R/scores.lda.R	                        (rev 0)
+++ pkg/vegan/R/scores.lda.R	2009-10-03 05:52:20 UTC (rev 1027)
@@ -0,0 +1,16 @@
+`scores.lda` <-
+    function(x, display, ...)
+{
+    require(MASS) || stop("'lda' objects created in MASS need MASS for 'scores'")
+    display <- match.arg(display,
+                         c("sites", "species", "scores", "predictors", "x", "coef"),
+                         several.ok = TRUE)
+    out <- NULL
+    if (display %in% c("sites", "scores", "x"))
+        out[["scores"]] <- predict(x)$x
+    if (display %in% c("species", "predictors", "coef"))
+        out[["coefficients"]] <- coef(x)
+    if (length(out) == 1)
+        out <- out[[1]]
+    out
+}

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2009-10-03 05:29:08 UTC (rev 1026)
+++ pkg/vegan/inst/ChangeLog	2009-10-03 05:52:20 UTC (rev 1027)
@@ -4,6 +4,11 @@
 
 Version 1.16-31 (opened October 3, 2009)
 
+	* scores.lda: new function to extract row scores and predictor
+	coefficients from "lda" objects (MASS package). Magically,
+	ordiplot() started to work with "lda" results. Not yet documented,
+	but alias in scores.default.Rd.
+
 	* ordiplot: uses linestack() to plot 1-col results, and now really
 	is able to identify if there were no species scores (tried
 	earlier, but failed because species had different names than

Modified: pkg/vegan/man/scores.Rd
===================================================================
--- pkg/vegan/man/scores.Rd	2009-10-03 05:29:08 UTC (rev 1026)
+++ pkg/vegan/man/scores.Rd	2009-10-03 05:52:20 UTC (rev 1027)
@@ -1,6 +1,7 @@
 \name{scores}
 \alias{scores}
 \alias{scores.default}
+\alias{scores.lda}
 
 \title{ Get Species or Site Scores from an Ordination }
 \description{



More information about the Vegan-commits mailing list