From MMa at mdanderson.org  Thu Mar 23 20:29:25 2017
From: MMa at mdanderson.org (Ma,Man Chun John)
Date: Thu, 23 Mar 2017 19:29:25 +0000
Subject: [Rd] A question on stats::as.hclust.dendrogram
Message-ID: <6B798A745F130A4DBED27B850427CFF9A474C7@D1PWPEXMBX06.mdanderson.edu>

Hi all,

This is the first time I'm writing to R-devel, and this time I'm just asking for the purpose for a certain line of code in stats::as.hclust.dendrogram, which comes up as I'm trying to fix dendextend.

The line in question is at line 128 of dendrogram.R in R-3.3.3, at stats::as.hclust.dendrogram:

stopifnot(length(s) == 2L, all( vapply(s, is.integer, NA) ))

Is there any legitimate possibility that s is a nested list? Currently I have a case where a dendrogram object is breaks at this line, because s is a nested list:

>str (s)
List of 2
$ : int -779
$ :List of 2
  ..$ : int -625
  ..$ : int 15

I'm unsure if my dendrogram was malformed in the first place, since I was trying to use dendrapply.

So, my question is: for that particular check, why use

stopifnot(length(s) == 2L, all( vapply(s, is.integer, NA) ))

instead of

stopifnot(length(s) == 2L, all( vapply(unlist(s), is.integer, NA) ))?

I appreciate your time and I'm looking forward to your response.

Cheers,

Man Chun John Ma, PhD
Postdoctoral Fellow
Unit 0903
Dept Lymphoma & Myeloma Research
1515 Holcombe Blvd.
Houston, TX 77030
MMa at mdanderson.org

The information contained in this e-mail message may be ...{{dropped:14}}



[Rd] A question on stats::as.hclust.dendrogram
Ma,Man Chun John