X-Git-Url: https://git.auder.net/?p=epclust.git;a=blobdiff_plain;f=epclust%2Ftests%2Ftestthat%2Fhelper.computeMedoidsIndices.R;h=cd6a30e94a336f0fa18aadc388949e46f38bf63d;hp=9342feb2b06f6ba44d2c43d12c1bf8979df6ed28;hb=d9bb53c5e1392018bf67f92140edb10137f3423c;hpb=9f05a4a0b703deffd7bdb9cd99b0aaa2246a5c83 diff --git a/epclust/tests/testthat/helper.computeMedoidsIndices.R b/epclust/tests/testthat/helper.computeMedoidsIndices.R index 9342feb..cd6a30e 100644 --- a/epclust/tests/testthat/helper.computeMedoidsIndices.R +++ b/epclust/tests/testthat/helper.computeMedoidsIndices.R @@ -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 }