[R] Advice on exploration of sub-clusters in hierarchical dendrogram

ilai keren at math.montana.edu
Fri Feb 24 15:57:52 CET 2012


Inline:

On Thu, Feb 23, 2012 at 8:23 PM, R. Michael Weylandt
<michael.weylandt at gmail.com> <michael.weylandt at gmail.com> wrote:
> Inline:
>
> On Feb 23, 2012, at 6:20 PM, kosmo7 <dnicolgr at hotmail.com> wrote:
>
>> Dear Elai,
>> thank you very much for your suggestion. I tried cutting the dendrogram
>> instead of the hclust tree with:
>> clusters<-cut(x, h=1.6)
>>
>> but then when I try to call/plot cluster 1 for example, with:
>> plot(clusters$lower[[1]])
>>
>> I get only 2 members that are joined together at distance=0  (cluster 1 for
>> instance, consists of several hundred of members).
>> So it looks like / plot(clusters$lower[[1]])/ only calls the very first node
>> of the tree and not the content of the respective cluster [[1]] at the
>> defined cutoff=1.6.

The "suggestions" in my original post are just pointers to the fact
there are methods for class dendrogram to achieve what you wanted.
Since you got as far as x<-as.dendrogram(z) I assumed that's all you
needed.

Maybe /cut/ instead of /cutree/ doesnt do the work? Or
>> maybe I am just doing something  wrong?...

The examples in ?as.dendrogram and ?dendrapply are self contained,
very clear and straight forward. If you haven't done so already I
suggest you try them. Most likely the problem is in your data
(row.names ? ) or your interpretation of who is "cluster1" or the 1.6
cutoff.

>>
>>
>>
>> In another post I read that with /df[value %in% v, ] / I can extract
>> specific subsets of a data frame/table.
>

Seems I missed some back and forth on this post already, so my
apologies if this is no longer an issue. Personally I find that
because there are many more nodes and info in a tree than rows in the
data set (leaf nodes only) much of the "usual" generic R solutions get
distorted when it comes to trees. Better to use appropriate methods
for the class (dendrapply helps as I've said before).

Hope that helps dig you out of the hole.
Elai


> That was me and there's a slight mistake in that post (corrected by Sarah): should be
>
> df[df$value %in% v, ]
>
> Sorry for any confusion that might have caused
>
> Michael
>> Maybe I could use this to extract
>> only the distances of members of a specific cluster as defined by cutree
>> from the initial distance matrix? But still, I am afraid I don't get what I
>> should use as /value/ and /v/....
>>
>> --
>> View this message in context: http://r.789695.n4.nabble.com/Advice-on-exploration-of-sub-clusters-in-hierarchical-dendrogram-tp4414277p4415589.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list