if (FALSE) {
dend <- USArrests[1:5, ] %>%
dist() %>%
hclust("ave") %>%
as.dendrogram()
# reproduces "labels_colors<-"
# although it does force us to run through the tree twice,
# hence "labels_colors<-" is better...
plot(dend)
dend2 <- dend %>%
assign_values_to_nodes_nodePar(value = 19, nodePar = "pch") %>%
assign_values_to_nodes_nodePar(value = c(1, 2), nodePar = "cex") %>%
assign_values_to_nodes_nodePar(value = c(2, 1), nodePar = "col")
plot(dend2)
### Making sure this works for NA with character.
dend %>%
assign_values_to_nodes_nodePar(value = 19, nodePar = "pch") %>%
assign_values_to_nodes_nodePar(value = c("red", NA), nodePar = "col") -> dend2
plot(dend2)
}
Run the code above in your browser using DataLab