Description Usage Arguments Value Examples
View source: R/replace_na_with_major_genotype.R
replace_na_with_major_genotype
replaces missing values with the most
frequent genotype at each marker locus.
1 | replace_na_with_major_genotype(dat, missing_value, major_genotype)
|
dat |
A matrix. Genotype names are stored in rows whereas marker names are stored in columns. |
missing_value |
Specify the encoding of missing genotypes. |
major_genotype |
Vector with the major allele at each locus. |
A matrix of the same type as dat
but with missing values
replaced by the major genotype at the corresponding locus.
1 2 3 4 5 6 7 8 9 10 11 | # Load a matrix with SNP genotypes encoded as numeric values
data(marker_numeric)
# Compute the major genotype at each locus.
major_genotype <- sspredr::compute_maf(marker_numeric, output = "geno_list",
missing = NA_real_,
maf_threshold = 0)[["major_genotype"]]
# Replace all missing genotypes with the major allele.
replace_na_with_major_genotype(marker_numeric, missing_value = NA_real_,
major_genotype = major_genotype)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.