haplotype_counts: Count the number of times each haplotype occurs

View source: R/count_haplotypes.R

haplotype_countsR Documentation

Count the number of times each haplotype occurs

Description

Count the number of times each haplotype occurs

Usage

haplotype_counts(x)

Arguments

x

DataFrame (by locus) of character vectors containing haplotypes (rows) where alleles are separated by comma's, e.g. "13,14.2" is a haplotype

Value

Integer vector with count for each row in DataFrame

Examples

# read haplotypes
h <- readxl::read_excel(system.file("extdata","South_Australia.xlsx",
package = "disclapmix2"), 
col_types = "text")[-c(1,2)]

# obtain counts
counts <- disclapmix2::haplotype_counts(h)

# all haplotypes in the dataset are unique
stopifnot(all(counts == 1))

disclapmix2 documentation built on April 12, 2023, 12:41 p.m.