The LDR functions all operate in the same fashion. X: p*n matrix, p > n. The p rows are features, the n columns are samples. LDR is intended for the case p >> n. Returns: (n-1)*n matrix In R, instead of kmeans(Y, ...), use kmeans(t(ldr(t(Y))), ...), Y is n*p, p > n Do not use if p <= n. If p <= n, returns X itself unmodified.