- #TODO: can we avoid this loop? ( synchrones = sweep(synchrones, 1, counts, '/') )
- for (i in seq_len(K))
- synchrones[i,] = synchrones[i,] / counts[i,1]
- #NOTE: odds for some clusters to be empty? (when series already come from stage 2)
- # ...maybe; but let's hope resulting K1' be still quite bigger than K2
- noNA_rows = sapply(seq_len(K), function(i) all(!is.nan(synchrones[i,])))
- if (all(noNA_rows))
- return (synchrones)
- # Else: some clusters are empty, need to slice synchrones
- synchrones[noNA_rows,]