[R] accessing nodes in a dendrogram

Jesse D Lecy jdlecy at maxwell.syr.edu
Fri Nov 16 13:59:42 CET 2007


Hi All,

I am new to R, so please excuse the simplicity of the question.  I am trying to remove nodes from a dendrogram - specifically nodes that have less than 3 members.  I am trying to create a function to do so, but I am not sure how to reference the node inside of the function.  Here is the code:

  rem.nodes <<- function(n) {
      if(!is.leaf(n) & attr(n, "members")<3) {

      REMOVE N ?? }    }

reduced.dend <- dendrapply(dend1, rem.nodes)

I just don't know how to reference the specific node element in the dendrogram list.  Any ideas are appreciated!


Jesse




More information about the R-help mailing list