make.snp.dummy: SNPs to Dummy Variables

Description Usage Arguments Details Value Note Author(s)

View source: R/make.snp.dummy.R


Transforms SNPs into binary dummy variables.





a matrix in which each column corresponds to a SNP and each row to an observation. The genotypes of all SNPs must be either coded by 1 (for the homozygous reference genotype), 2 (heterozygous), and 3 (homozygous variant) or by 0, 1, 2. It is not allowed that some SNPs following the 1, 2, 3 coding scheme and some SNPs the 0, 1, 2 coding. Missing values are allowed, but please note that neither logic.bagging nor logicFS can handle missing values so that the missing values need to be imputed (preferably before an application of make.snp.dummy.


make.snp.dummy assumes that the homozygous dominant genotype is coded by 1, the heterozygous genotype by 2, and the homozygous recessive genotype by 3. Alternatively, the three genotypes can be coded by the number of minor alleles, i.e. by 0, 1, and 2. For each SNP, two dummy variables are generated:


At least one of the bases explaining the SNP are of the recessive type.


Both bases are of the recessive type.


A matrix with 2*ncol(data) columns containing 2 dummy variables for each SNP.


See the R package scrime for more general functions for recoding SNPs.


Holger Schwender,

logicFS documentation built on Nov. 8, 2020, 5:23 p.m.