From 586ac47ff9d7e58f1c33b9f3ee007a41ccc6b51b Mon Sep 17 00:00:00 2001 From: Jari Oksanen Date: Thu, 16 Jul 2020 15:32:59 +0300 Subject: [PATCH] pcnm failed if all distances == 0 (cherry picked from commit dfa612593cb5b3acacbe9d4e76b441b71274043e) --- R/pcnm.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/R/pcnm.R b/R/pcnm.R index 99a6760a9..841b6afc6 100644 --- a/R/pcnm.R +++ b/R/pcnm.R @@ -18,7 +18,8 @@ weights = mypcnm$weig) k <- ncol(mypcnm$points) res$vectors <- sweep(res$vectors, 2, sqrt(res$values[seq_len(k)]), "/") - colnames(res$vectors) <- paste("PCNM", 1:k, sep="") + if (NCOL(res$vectors)) + colnames(res$vectors) <- paste("PCNM", 1:k, sep="") res$threshold <- threshold if (dist.ret) { attr(dis, "method") <- paste(attr(dis, "method"), "pcnm")