[adegenet-forum] error in find.clusters hierarchically

Crameri Simon simon.crameri at env.ethz.ch
Thu Jul 30 11:52:29 CEST 2015


Hi Thibaut

There seems to be a problem with the function find.clusters if applied hierarchically using the argument clust:

> test

   #####################
   ### Genind object ###
   #####################
- genotypes of individuals -

S4 class:  genind
@call: .local(x = x, i = i, j = j, drop = drop)

@tab:  396 x 209 matrix of genotypes

@ind.names: vector of  396 individual names
@loc.names: vector of  20 locus names
@loc.nall: number of alleles per locus
@loc.fac: locus factor for the  209 columns of @tab
@all.names: list of  20 components yielding allele names for each locus
@ploidy:  2
@type:  codom

Optional contents:
@pop:  - empty -
@pop.names:  - empty -

@other: - empty -


> str(clustfac)
 Factor w/ 4 levels "A","B","C","D": 1 1 1 1 1 1 1 1 1 1 …



This is where the error appears:

> hclust <- find.clusters(test, clust=clustfac)

Looking for sub-clusters in cluster A
Choose the number PCs to retain (>=1):
32
Error: number of cluster centres must lie between 1 and nrow(x)


> table(clustfac)
clustfac
     A     B     C     D
    33    30   138   195


If not applied hierarchically, find.clusters will take the maximal available n.pca, even if the n.pca argument passed over is greater than nrow(x), right? Here, 33 individuals have factor level "A", therefore 32 is NOT outside 1 and nrow(x). The same error appears when using any number of PCs, say  2, 5, 30 or 400.

What went wrong? Any help is greatly appreciated.


Best,
Simon


PhD Candidate
Institute of Integrative Biology
ETH Zurich
Switzerland
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20150730/ea42b750/attachment-0001.html>


More information about the adegenet-forum mailing list