[Rd] A question on stats::as.hclust.dendrogram

Ma,Man Chun John MMa at mdanderson.org
Thu Mar 23 20:29:25 CET 2017


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}}



More information about the R-devel mailing list