Error pvclust package: Error in hclust(distance, method = method.hclust) : must have n >= 2 objects to cluster

Could you help me resolve the following error:

Error in hclust(distance, method = method.hclust) : 
  must have n >= 2 objects to cluster

I'm trying to use the pvclust package, but I'm not able to generate the dendogram. If I use all data from the df database, I can generate it, but as I am restricting only to the coordinates (Latitude and Longitude), it is not working, it gives the error that I mentioned. Below, I entered an executable code.

Thank you so much!

###USING PVCLUST

library(rdist)
library(pvclust)
library(geosphere)

df <- structure(
  list(Industries = c(1,2,3,4,5,6,7), Latitude = c(-24.779225, -24.789635, -24.763461, -24.794394, -24.747102,-24.781307,-24.761081),
       Longitude = c(-49.934816, -49.922324, -49.911616, -49.906262, -49.890796,-49.8875254,-49.8875254), 
       Waste = c(526, 350, 526, 469, 285, 433, 456)),class = "data.frame", row.names = c(NA, -7L))

mat <- as.data.frame.matrix(df)
mat <- t(mat)
fit <- pvclust(mat, method.hclust="average", method.dist="euclidean")
fit
plot(fit)
pvrect(fit)

enter image description here

# RESTRICTING ONLY TO COORDINATES

coordinates<-subset(df,select=c("Latitude","Longitude")) 
mat <- as.data.frame.matrix(coordinates)
mat <- t(mat)
fit <- pvclust(mat, method.hclust="average", method.dist="euclidean")
> fit <- pvclust(mat, method.hclust="average", method.dist="euclidean")
Bootstrap (r = 0.5)... Error in hclust(distance, method = method.hclust) : 
  must have n >= 2 objects to cluster*****

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.