MakeFactor | R Documentation |
MakeFactor
converts bi-allelic genetic marker data, whether coded numerically
as (0,1,2) or as (GG,GT,TT), etc. into standard factors coded as AA,
AB, BB.
MakeFactor(x, coding = c(0, 1, 2))
x |
A vector containing genotyping results |
coding |
Describes the numerical coding of the genotype data in
order AA, AB and BB. Only relevant if |
If x
is a factor, it will be coerced to a factor with
levels AA, AB and BB. Important detail: the produced factors will have
only those levels that are observed in the data. E.g., if genotyping
results only consist of (0,1), then the resulting factor will not have
level BB (which would be an empty category)
A factor variable
Jan Graffelman jan.graffelman@upc.edu
MakeCounts
y <- c(1,1,0,0,2,2)
data.frame(y,MakeFactor(y))
y <- c(2,2,3,3,1,1)
data.frame(y,MakeFactor(y,coding=c(1,2,3)))
data(Markers)
data.frame(Markers[,1],MakeFactor(Markers[,1],coding=c(1,2,3)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.