View source: R/marker_allelematrix.R
| splitGenotypes | R Documentation |
Converts a matrix or data frame with one genotype column per marker into a matrix with two allele columns per marker. Malformed genotypes give an error.
splitGenotypes(x, sep = NULL, missing = 0, clean = FALSE, colNames = FALSE)
x |
A matrix or data frame containing genotypes. |
sep |
Allele separator. If NULL, detected automatically from the first 50 non-missing genotypes, trying "/", ",", "-", ";" and " ". |
missing |
Symbol for missing alleles (default 0). |
clean |
If TRUE, trim whitespace and fill in missing individual alleles, e.g. "1/" becomes "1/0". Default FALSE for speed. |
colNames |
If TRUE, append |
A matrix with twice as many columns as x, preserving row names. Missing
alleles are represented by missing, except for completely missing input, which
returns a matrix of zeroes.
x = cbind(M1 = c("1/2", "/3"), M2 = c(NA, "1/1"))
splitGenotypes(x, clean = TRUE, colNames = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.