Skip to content

plot.hclust: strange behaviour with "manufactured" hclust object

1 message · Hugh Chipman

#
I've been trying to get plot.hclust to work with a hclust object I
created and have not had much success.  It seems that there is some
"hidden" characteristic of a hclust object that I can't see.  This is
most easily seen in the following example, where plot.hclust works on
one object, but when this object is "dumped" and then re-read,
plot.hclust no longer works.  Is this a scoping problem?

Script started on Wed Feb 20 13:17:37 2002
1>@icarus[101]% R

R : Copyright 2002, The R Development Core Team
Version 1.4.1  (2002-01-30)

......(stuff deleted)
# the above works
Error in plot.hclust(x.hc) : invalid dendrogram input

One hypothesis I had was that it might be something like the "call"
object that wasn't correctly being re-created by the dump & source,
but that doesn't seem to be it.  Below, I remove everything except
merge, order, and height, and plot.hclust still works on the original
object and fails on the dump + source object.
Error in plot.hclust(x.hc) : invalid dendrogram input
List of 3
 $ merge : num [1:4, 1:2] -2 -5 -1 -4 -3 1 2 3
 $ height: num [1:4] 0.873 1.257 1.633 2.430
 $ order : num [1:5] 4 1 5 2 3
 - attr(*, "class")= chr "hclust"

Any help would be greatly appreciated!

Hugh Chipman