grouping-methods {haplotypes} | R Documentation |
Groups haplotypes according to the grouping variable (populations, species, etc.)
Description
Function for creating a matrix with haplotypes as rows, grouping factor (populations, species, etc.) as columns and abundance as entries.
Usage
## S4 method for signature 'Haplotype'
grouping(x,factors)
Arguments
x |
an object of class |
factors |
a vector or factor giving the grouping variable (populations, species, etc.), with one element per individual. |
Value
a list with two components:
hapmat
:a matrix with haplotypes as rows, levels of the grouping factor (populations, species, etc.) as columns and abundance as entries.
hapvec
:a vector giving the haplotype identities of individuals.
Methods
signature(x = "Haplotype")
Author(s)
Caner Aktas, caktas.aca@gmail.com
See Also
Examples
data("dna.obj")
x<-dna.obj[1:6,,as.matrix=FALSE]
# inferring haplotypes from DNA sequences
h<-haplotype(x)
## Grouping haplotypes.
# character vector 'populations' is a grouping factor.
populations<-c("pop1","pop1","pop2","pop3","pop3","pop3")
# length of the argument 'factor' is equal to the number of sequences
g<-grouping(h,factors=populations)
g
[Package haplotypes version 1.1.3.1 Index]