[Archetypes-commits] r63 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Sep 10 15:31:56 CEST 2012


Author: manuel
Date: 2012-09-10 15:31:56 +0200 (Mon, 10 Sep 2012)
New Revision: 63

Modified:
   pkg/R/archetypes-map.R
Log:
archmap bug fixed

Modified: pkg/R/archetypes-map.R
===================================================================
--- pkg/R/archetypes-map.R	2012-08-01 12:01:13 UTC (rev 62)
+++ pkg/R/archetypes-map.R	2012-09-10 13:31:56 UTC (rev 63)
@@ -8,7 +8,7 @@
 #' @param projection Projection function; see
 #'   \code{\link{archmap_projections}}
 #' @param projection_args Arguments passed to the projection function;
-#'   see \code{\link{archmap_projections}} 
+#'   see \code{\link{archmap_projections}}
 #' @param rotate Rotation angle to rotate the projection
 #' @param cex Character expansion of archetypes
 #' @param col Color of observations
@@ -126,19 +126,18 @@
 #' @export
 tspsimplex_projection <- function(x, r = 10, equidist = FALSE, ...) {
   stopifnot(require("TSP"))
- 
+
   d <- dist(x)
   xo <- as.integer(solve_TSP(TSP(d), ...))
-  
+
   if ( equidist ) {
     phi <- seq(-pi, pi, length.out = nrow(x) + 1)
     phi <- phi[-1][xo]
   } else {
     d <- as.matrix(d)
     phi <- mapply(function(i, j) d[i, j], xo, c(tail(xo, -1), xo[1]))
-    phi <- c(0, cumsum(phi) / sum(phi))
+    phi <- (phi - min(phi)) / (max(phi) - min(phi))
     phi <- phi * 2 * pi - pi
-    phi <- phi[-1]
   }
 
   cbind(x = r * cos(phi),



More information about the Archetypes-commits mailing list