[Vegan-commits] r1987 - branches/2.0/R branches/2.0/inst branches/2.0/man www

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Nov 5 15:04:04 CET 2011


Author: jarioksa
Date: 2011-11-05 15:04:04 +0100 (Sat, 05 Nov 2011)
New Revision: 1987

Modified:
   branches/2.0/R/ordiarrows.R
   branches/2.0/R/ordisegments.R
   branches/2.0/inst/ChangeLog
   branches/2.0/inst/NEWS.Rd
   branches/2.0/man/ordiarrows.Rd
   www/NEWS.html
Log:
merge r1985: ordiarrows/segments gainded 'order.by'

Modified: branches/2.0/R/ordiarrows.R
===================================================================
--- branches/2.0/R/ordiarrows.R	2011-11-05 13:40:24 UTC (rev 1986)
+++ branches/2.0/R/ordiarrows.R	2011-11-05 14:04:04 UTC (rev 1987)
@@ -1,11 +1,19 @@
-"ordiarrows" <-
-    function (ord, groups, levels, replicates, display = "sites",
-              show.groups, startmark, label = FALSE, ...)
+`ordiarrows` <-
+    function (ord, groups, levels, replicates, order.by, 
+              display = "sites", show.groups, startmark, label = FALSE, ...)
 {
     pts <- scores(ord, display = display, ...)
     npoints <- nrow(pts)
     if (missing(groups))
         groups <- gl(levels, replicates, npoints)
+    if (!missing(order.by)) {
+        if (length(order.by) != nrow(pts))
+            stop(gettextf("the length of order.by (%d) does not match the number of points (%d)",
+                 length(order.by), nrow(pts)))
+        ord <- order(order.by)
+        pts <- pts[ord,]
+        groups <- groups[ord]
+    }
     if (!missing(show.groups)) {
         take <- groups %in% show.groups
         pts <- pts[take, , drop = FALSE]

Modified: branches/2.0/R/ordisegments.R
===================================================================
--- branches/2.0/R/ordisegments.R	2011-11-05 13:40:24 UTC (rev 1986)
+++ branches/2.0/R/ordisegments.R	2011-11-05 14:04:04 UTC (rev 1987)
@@ -1,11 +1,19 @@
-"ordisegments" <-
-    function (ord, groups, levels, replicates, display = "sites",
+`ordisegments` <-
+    function (ord, groups, levels, replicates, order.by, display = "sites",
               show.groups, label = FALSE, ...)
 {
     pts <- scores(ord, display = display, ...)
     npoints <- nrow(pts)
     if (missing(groups))
         groups <- gl(levels, replicates, npoints)
+    if (!missing(order.by)) {
+        if (length(order.by) != nrow(pts))
+            stop(gettextf("the length of order.by (%d) does not match the number of points (%d)",
+                 length(order.by), nrow(pts)))
+        ord <- order(order.by)
+        pts <- pts[ord,]
+        groups <- groups[ord]
+    }
     if (!missing(show.groups)) {
         take <- groups %in% show.groups
         pts <- pts[take, , drop = FALSE]

Modified: branches/2.0/inst/ChangeLog
===================================================================
--- branches/2.0/inst/ChangeLog	2011-11-05 13:40:24 UTC (rev 1986)
+++ branches/2.0/inst/ChangeLog	2011-11-05 14:04:04 UTC (rev 1987)
@@ -4,6 +4,7 @@
 
 Version 2.0-2 (opened October 20, 2011)
 
+	* merge r1985: ordiarrows, ordisegments gained arg 'order.by'.
 	* merge r1974,1975,1980,1982: FAQ update.
 	* merge r1970: ordispider returns invisible plotting structure.
 	* merge r1969: ordiplot3d.Rd tells about xyz.convert().

Modified: branches/2.0/inst/NEWS.Rd
===================================================================
--- branches/2.0/inst/NEWS.Rd	2011-11-05 13:40:24 UTC (rev 1986)
+++ branches/2.0/inst/NEWS.Rd	2011-11-05 14:04:04 UTC (rev 1987)
@@ -28,6 +28,10 @@
  
  \subsection{NEW FEATURES}{
    \itemize{
+
+     \item \code{ordiarrows} and \code{ordisegments} gained argument
+     \code{order.by} to give a variable used to sort points within
+     \code{groups}. Earlier the points were assumed to be in order.
       
      \item Function \code{ordispider} invisibly returns the
      coordinates to which the points are connected.  Typically these

Modified: branches/2.0/man/ordiarrows.Rd
===================================================================
--- branches/2.0/man/ordiarrows.Rd	2011-11-05 13:40:24 UTC (rev 1986)
+++ branches/2.0/man/ordiarrows.Rd	2011-11-05 14:04:04 UTC (rev 1987)
@@ -11,9 +11,9 @@
   \code{\link{ordiplot}}.  }
 
 \usage{
-ordiarrows(ord, groups, levels, replicates, display = "sites",
+ordiarrows(ord, groups, levels, replicates, order.by, display = "sites",
          show.groups, startmark, label = FALSE, ...)
-ordisegments(ord, groups, levels, replicates, display = "sites",
+ordisegments(ord, groups, levels, replicates, order.by, display = "sites",
          show.groups, label = FALSE, ...)
 ordigrid(ord, levels, replicates, display = "sites",  lty = c(1,1), 
          col = c(1,1), lwd = c(1,1), ...)
@@ -28,6 +28,9 @@
     \code{replicates}, where \code{levels} gives the number of groups,
     and \code{replicates} the number of successive items at the same
     group.}
+  \item{order.by}{Order points by increasing order of this variable
+    within \code{groups}. Reverse sign of the variable for decreasing
+    ordering.} 
   \item{display}{Item to displayed. }
   \item{show.groups}{Show only given groups. This can be a vector, or
     \code{TRUE} if you want to show items for which condition is

Modified: www/NEWS.html
===================================================================
--- www/NEWS.html	2011-11-05 13:40:24 UTC (rev 1986)
+++ www/NEWS.html	2011-11-05 14:04:04 UTC (rev 1987)
@@ -46,6 +46,11 @@
 
 
 <ul>
+<li> <p><code>ordiarrows</code> and <code>ordisegments</code> gained argument
+<code>order.by</code> to give a variable used to sort points within
+<code>groups</code>. Earlier the points were assumed to be in order.
+</p>
+</li>
 <li><p> Function <code>ordispider</code> invisibly returns the
 coordinates to which the points are connected.  Typically these
 are class centroids for each point, but for constrained



More information about the Vegan-commits mailing list