Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in if (color == "cluster") color <- "default" : the condition has length > 1 #180

Open
14500066alga opened this issue Mar 7, 2024 · 1 comment

Comments

@14500066alga
Copy link

fviz_dend(hc, cex = 0.5,
main = "Dendrogram - ward.D2",
xlab = "Objects", ylab = "Distance", sub = "")
fviz_dend(hc, cex = 0.5, horiz = TRUE)

I am doing some practice as follows:
It’s also possible to cut the tree at a given height for partitioning the data into multiple
groups as described in the previous chapter: Hierarchical clustering (Chapter 7). In
this case, it’s possible to color branches by groups and to add rectangle around each
group.
When I try to run the code (below):

fviz_dend(hc, k = 4, # Cut in four groups
cex = 0.5, # label size
k_colors = c("#2E9FDF", "#00AFBB", "#E7B800", "#FC4E07"),
color_labels_by_k = TRUE, # color labels by groups
rect = TRUE, # Add rectangle around groups
rect_border = c("#2E9FDF", "#00AFBB", "#E7B800", "#FC4E07"),
rect_fill = TRUE)

It resulted in this error (below):
Error in if (color == "cluster") color <- "default" :
the condition has length > 1

Please can some gives the solution for this issue?

@hsinhang-liang
Copy link

I also met this question in the practice of the code by book, so confused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants