add comments, fix some things. TODO: comment tests, finish computeWerDists, test it
[epclust.git] / epclust / tests / testthat / helper.computeMedoidsIndices.R
index 9342feb..cd6a30e 100644 (file)
@@ -1,10 +1,12 @@
-#R-equivalent of computeMedoidsIndices, requiring a matrix
-#(thus potentially breaking "fit-in-memory" hope)
+# R-equivalent of computeMedoidsIndices, requiring a matrix
+# (thus potentially breaking "fit-in-memory" hope)
 R_computeMedoidsIndices <- function(medoids, series)
 {
-       nb_series = ncol(series)
+       nb_series = ncol(series) #series in columns
+
        mi = rep(NA,nb_series)
        for (i in 1:nb_series)
                mi[i] <- which.min( colSums( sweep(medoids, 1, series[,i], '-')^2 ) )
+
        mi
 }