Hi Peter,

Thanks for your help. A second simple question that I cannot solve is the
following.

labels = cutree(hc, h=500)
# members of cluster 1:
x[labels==1]
# members of cluster 2:
x[labels==2]

When x is >= 8 the index numbers appear in the output:

[['[1]', '180066408', '180066464', '180066465', '180066483', '180066486',
'180066518', '180066525', '[8]', '180066554', '180066623', '180066638',
'180066652', '18006681
9', '180066884']]

As opposed to when they are less than 8:

 [['150329963', '150329989', '150330179', '150330299', '150330375',
'150330460']]

Is there a simple way to make these index numbers disappear?

Thanks





On Wed, May 11, 2011 at 10:53 AM, Peter Langfelder <
peter.langfel...@gmail.com> wrote:

> On Wed, May 11, 2011 at 10:12 AM, rna seq <rna.see...@gmail.com> wrote:
> > Hello List,
> >
> > I am trying to implement a hierarchical cluster using the hclust method
> > agglomerative single linkage method with a small wrinkle. I would like to
> > cluster a set of numbers on a number line only if they are within a
> distance
> > of 500. I would then like to print out the members of this list.
> >
> > So far I can put a vector:
> >> x<-c(2,10,200,300,600,700)
> > into a distance matrix:
> >> dist(x,method="manhattan")
> >    1   2   3   4   5
> > 2   8
> > 3 198 190
> > 4 298 290 100
> > 5 598 590 400 300
> > 6 698 690 500 400 100
> >
> > I can then cluster these distances using:
> >>hc<-hclust(v, method = "complete")
> >
> > Next, I "believe" I set my distance limit in the cluster using the
> command
> >
> >>cutree(hc, h=500)
> > 1 1 1 1 2 2 1 3
> > [1] 1 1 1 1 2 2
> >
> > This seems to produce the correct result however, whatt I am unable to do
> is
> > go back and extract and print out the members of each cluster. Any herp
> > would be greatly appreciated.
>
> Very simple.
>
> labels = cutree(hc, h=500)
> # members of cluster 1:
> x[labels==1]
> # members of cluster 2:
> x[labels==2]
>
> HTH,
>
> Peter
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to