I am trying to perform hierarchical clustering and I want to use nbclust in order to identify the optimal number of clusters. However, I keep getting the following error:
Error in t(jeu) %*% jeu : requires numeric/complex matrix/vector arguments
I already produced a dissimilarity matrix and plotted the dendogram. My dataset comprises of 2 numeric variables and 260 observations.
I have tried a couple of solutions suggested in other questions, such asnot including the data in the function and only use the dissimilarity matrix but I get the following error:
Data matrix is needed. Only frey, mcclain, cindex, sihouette and dunn can be computed.
The code I've been using is the following:
dist.gower <- daisy(mydata, metric = "gower")
aggl.clust.c <- hclust(dist.gower, method = "complete")
plot(aggl.clust.c,
main = "Agglomerative, complete linkages")
NbClust(mydata, diss="dist.gower", method= "complete", index="all")
The dendrogram is plotted succesfully, but I keep getting this error message:
Error in t(jeu) %*% jeu : requires numeric/complex matrix/vector arguments