I am trying to cluster my data using hclust
and print to a html using Rmarkdown.
When I call hclust
from the console or in an .Rmd, the clustering occurs perfectly exactly as I want it. But additionally, I receive the error message:
must have n >= 2 objects to cluster
I can force knitr to continue processing using error=TRUE
, but the error is there and the value not assigned.
tree = hclust(dist(t(sample_matrix), method = "euclidean"), method = "complete")
I want to process object tree
further
I have also tried "fixing" the error by using try(...,silent=TRUE)
. It works as long as I don't need to assign the returned value.
Also tryCatch
doesn't seem to help with this (correct me if I'm wrong).
How can I suppress this error message in my Rmarkdown?