Learn R Programming

diemr (version 1.4.3)

sStateCount: Count states in a vector

Description

Counts genomic states in one sample.

Usage

sStateCount(s)

Value

Numeric vector of length 4 with counts of "_", "0", "1", "2" respectively.

Arguments

s

A character vector with elements "_", "0", "1", "2" representing missing data, homozygots for allele 1, heterozygots, and homozygots for allele 2. The vector should represent a single individual.

Details

Summarizes the number of markers that are fixed for an allele in the genome of one individual. This is used to construct the I4 matrix in diem.

See Also

emPolarise for changing marker polarity.

Examples

Run this code
genotype <- c("0", "0", "_", "2", "1", "0", "1")
sStateCount(genotype)
# [1] 1 3 2 1

# calculate state counts for a polarised genotype
sStateCount(emPolarise(genotype, TRUE))
# [1] 1 1 2 3

Run the code above in your browser using DataLab