importPolarized {diemr} | R Documentation |
Reads genotypes from a file and changes marker polarity.
importPolarized(file, changePolarity, ChosenInds)
file |
character vector with a single path to a file with genotypes. |
changePolarity |
logical vector with length equal to the number of markers. |
ChosenInds |
numeric vector of indices of individuals to be included in the analysis. |
For details on the input data format, check the file
with
CheckDiemFormat
.
The changePolarity
argument influences how each marker is imported. Value
FALSE
means that the marker will be imported as it is saved in the file
. Value
TRUE
means that the genotypes encoded as 0
will be imported as 2
, and genotypes
encoded in the file
as 2
will be imported as 0
.
Returns a character matrix with rows containing individual genotypes and columns containing markers.
diem
for determining appropriate marker polarity with
respect to a barrier to geneflow.
dat <- importPolarized(
file = system.file("extdata", "data6x3.txt", package = "diemr"),
changePolarity = c(FALSE, TRUE, TRUE),
ChosenInds = 1:6
)
dat
# m1 m2 m3
# 1 "0" "1" "2"
# 2 "0" "0" "0"
# 3 "1" "1" "0"
# 4 "1" "2" "0"
# 5 "2" "2" "1"
# 6 "2" "2" "_"