H clustering not working

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

database <- 'db_name'
server <- "server_name"
library(cluster)    
library(factoextra) 
library(dendextend)
suppressPackageStartupMessages(library(dendextend))
df <- na.omit(df)
head(df)
df_1 <- dist(df, method = "euclidean")
hc1 <- hclust(df_1, method = "complete")
plot(hc1, cex = 0.6, hang = -8)
rect.hclust(hc1, k = 4, border = 2:5)

I tried to run this code but instead I get the error:
Error in as.vector(x, mode) : cannot coerce type 'closure' to vector of type 'any'

Can you provide a reprex (FAQ: How to do a minimal reproducible example ( reprex ) for beginners)? I know you are using a db here but create the toy example with the same error so we can observe it. Otherwise I can't trace it back and see why it wouldn't run.

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.