[Analogue-commits] r352 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Jul 27 05:28:52 CEST 2013


Author: gsimpson
Date: 2013-07-27 05:28:52 +0200 (Sat, 27 Jul 2013)
New Revision: 352

Modified:
   pkg/R/prcurve.R
Log:
fix to the plot drawn via plotit = TRUE

Modified: pkg/R/prcurve.R
===================================================================
--- pkg/R/prcurve.R	2013-07-25 16:55:27 UTC (rev 351)
+++ pkg/R/prcurve.R	2013-07-27 03:28:52 UTC (rev 352)
@@ -40,6 +40,10 @@
     ## data stats
     n <- NROW(X) ## number of observations
     m <- NCOL(X) ## number of variables
+
+    ## fit a PCA and store in result
+    ord <- rda(X)
+
     ## starting configuration
     config <- startConfig <- initCurve(X, method = method,
                                        rank = rank,
@@ -127,8 +131,13 @@
         ## Converged?
         converged <- (abs((dist.old - config$dist)/dist.old) <=
                       thresh)
-        if(plotit)
-            plot(config, X, sub = paste("Iteration:", iter))
+        if(plotit) {
+            ## plot the iteration -- need to add some components
+            ## because of changes to plot method
+            config$data <- X
+            config$ordination <- ord
+            plot(config, sub = paste("Iteration:", iter))
+        }
         if (trace)
             writeLines(sprintf(paste("Iteration %",
                                      max(3, nchar(maxit)),
@@ -164,8 +173,11 @@
         config <- get.lam(X, s = s, stretch = stretch)
         class(config) <- "prcurve"
         if(plotit) {
-            ## plot the iteration
-            plot(config, X)
+            ## plot the iteration -- need to add some components
+            ## because of changes to plot method
+            config$data <- X
+            config$ordination <- ord
+            plot(config)
         }
         if (trace)
             writeLines(sprintf(paste("Iteration %", max(3, nchar(maxit)),
@@ -182,8 +194,6 @@
         }
         cat("\n")
     }
-    ## fit a PCA and store in result
-    ord <- rda(X)
     ## prepare objects for return
     names(config$tag) <- names(config$lambda) <-
         rownames(config$s) <- rownames(X)



More information about the Analogue-commits mailing list