Learn R Programming

simer (version 1.0.0)

geno.cvt2: Genotype code convertor 2

Description

Convert genotype matrix from (0, 1, 2) to (0, 1).

Usage

geno.cvt2(pop.geno, ncpus = 0)

Value

genotype matrix of (0, 1).

Arguments

pop.geno

genotype matrix of (0, 1, 2).

ncpus

the number of threads used, if NULL, (logical core number - 1) is automatically used.

Author

Dong Yin

Details

Build date: Jul 11, 2020 Last update: Jan 29, 2025

Examples

Run this code
# \donttest{
library(bigmemory)
options(bigmemory.typecast.warning=FALSE)
pop.geno <- matrix(sample(c(0, 1, 2), 8, replace = TRUE), 2, 4)
pop.geno[]
bigmat <- geno.cvt2(pop.geno)
bigmat[]
pop.geno <- as.big.matrix(pop.geno, type = 'char')
bigmat <- geno.cvt2(pop.geno)
bigmat[]
# }

Run the code above in your browser using DataLab