I don't use pvclust but from a cursory reading and from the error
indicating bootstrap I am guessing that pvclust carries out some sort of a
sampling of the features on which you cluster. Since you only retain two
features (coordinates), the sampling necessarily results in just one
feature being retained, leading to an error. Just my guess though;
understanding what pvclust does would help you diagnose the problem.

Peter

On Mon, Dec 14, 2020 at 2:48 PM Jovani T. de Souza <jovanisou...@gmail.com>
wrote:

> This question was also made in
>
> https://stackoverflow.com/questions/65290436/error-pvclust-package-error-in-hclustdistance-method-method-hclust-must
>
> Question:
>
> 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)
>
>
> # 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*****
>
>
>
>
> [image: Mailtrack]
> <
> https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5&;
> >
> Remetente
> notificado por
> Mailtrack
> <
> https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5&;
> >
> 14/12/20
> 19:37:37
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to