[Rd] error in plot.dendrogram (PR#7300)

maechler at stat.math.ethz.ch maechler at stat.math.ethz.ch
Thu Oct 21 19:01:09 CEST 2004


>>>>> "Witold" == Witold Eryk Wolski <wolski at molgen.mpg.de>
>>>>>     on Thu, 21 Oct 2004 16:52:26 +0200 writes:

    Witold> Hi,
    Witold> First. If you should not do it like you write here. You will get an 
    Witold> error loading the rda file. It is a binary format.

    Witold> Error in load(dFile) : input has been corrupted, with LF replaced by CR

no. I don't get such an error. 

    Witold> Hence, you should specify mode="wb" for downloading binary formats.

ok, at least to be on the safe side.
{Though I *never* had the need till now, and it's not the first
 time I download.file( "........./*.rda" ) .}

    Witold> Try this code.

    Witold> file.remove("hres.rda")

    Witold> dFile <- paste(getwd(),"/hres.rda",sep="")
    Witold> if(!file.exists(dFile))
    Witold> download.file(url ="http://www.molgen.mpg.de/~wolski/hres.rda", dest= dFile,mode="wb")
    Witold> load(dFile)

    Witold> hresd
    Witold> plot(hresd)

    Witold> In one think you are right, the X axis. But there is an ERROR.

    Witold> On my Machine (see previous mail) not the complete dendrogram is drawn. 
    Witold> It just draws the first 100 leavs out of 380 when I run
    Witold> Second.  Even if I increase the size of the window maximally the 
    Witold> dendrogram is not plotted.
    Witold> And I checked it just again on a linux box. And it does not work there 
    Witold> either.

well, it does work on mine...
(as I said, I quickly saw how unuseful single-linkage is for
 this data/dissimilarity ..)

ok, ok, -- now I see why:

I "just knew" that for largish dendrograms one had to do
something like

  options(expressions = 10000)

before anything reasonable can happen.. ;-)

So, yes, I finally see your problem.

The real R bug there is that no error message is *printed*,
for me at least, but the recursive function calls to plotNode()
just bail out.

If you do 
   str(hresd)
you at least get an error message that helps you find out about
options(expressions = ..)...


    Witold> How the dendrogram should look like you can figure out looking at the 
    Witold> following.

    Witold> hclustObj <- paste(getwd(),"/hress.rda",sep="")
    Witold> if(!file.exists(dFile))
    Witold> download.file(url ="http://www.molgen.mpg.de/~wolski/hress.rda", dest= hclustObj ,mode="wb")
    Witold> load(dFile)

(well, that doesn't work since you have replaced "dFile" by "hclustObj"
 in some places but not all.
 [[[ why on earth do you call a file name an object ?]]]
)

    Witold> hress
    Witold> plot(hress)

    Witold> hressd<-as.dendrogram(hress)
    Witold> plot(hressd)


    Witold> Third. I have expected this comment about if it is meaningfull or not.
    Witold> First for what I need it is it meaningfull. Second it is a valid 
    Witold> dendrogram generated by as.dendrogram from a vaild hclust object. I do 
    Witold> not need a plot routine which teaches me what she thinks is meaningfull 
    Witold> or not.

agreed on that.

Note that originally in your bug report,
you were telling about a missing x-axis and that set off the
whole track since, as we now agree, it's not about an x-axis at all...




    Witold> Martin Maechler wrote:

    >>>>>>> "Eryk" == Eryk Wolski <wolski at molgen.mpg.de>
    >>>>>>> on Thu, 21 Oct 2004 13:41:29 +0200 (CEST) writes:
    >>>>>>> 
    >>>>>>> 
    >> 
    Eryk> Hi,
    >> 
    Eryk> hres <- hclust(smatr,method="single")
    Eryk> hresd<-as.dendrogram(hres)
    Eryk> as.dendrogram(hres)
    Eryk> `dendrogram' with 2 branches and 380 members total, at height 2514.513 
    Eryk> plot(hresd,leaflab="none") #<-error here.
    >> 
    >> definitely no error here.. maybe your graphic window is too
    >> small or otherwise unable to show all the leaf labels?
    >> 
    Eryk> #the plotted dendrogram is incomplete. The x axis is not drawn.
    >> 
    >> ha! and why should this be a bug????
    >> Have you RTFHP and looked at its example??
    >> There's never an x-axis in such a plot!
    >> 
    >> [You really don't want an x-axis overlayed over all the labels]
    >> 
    Eryk> #The interested reader can download the
    >> 
    Eryk> save(hresd,file="hres.rda")
    >> 
    Eryk> #from the following loacation
    Eryk> www.molgen.mpg.de/~wolski/hres.rda
    >> 
    >> If you send a bug report (and please rather don't..),
    >> it should be reproducible, i.e., I've just wasted my time for 
    >> 
    >> dFile <- "/u/maechler/R/MM/Pkg-ex/stats/wolski-hres.rda"
    >> if(!file.exists(dFile))
    >> download.file(url ="http://www.molgen.mpg.de/~wolski/hres.rda", dest= dFile)
    >> load(dFile)
    >> hresd
    >> plot(hresd)
    >> 
    >> ----
    >> 
    >> If you look at this plot I hope you rather see that "single" has
    >> been an extremly unuseful clustering method for this data / dissimilarities,
    >> and you'd rather tried other methods than to which for an
    >> x-axis.
    >> 
    >> If you really want one (just to see that it doesn't make sense),
    >> you can always add
    >> axis(1, fg = "red")
    >> 
    >> Martin
    >>



More information about the R-devel mailing list