bed2matrix: Convert a bed to a matrix

View source: R/bed2matrix.R

bed2matrixR Documentation

Convert a bed to a matrix

Description

Convert a bed to a matrix

Usage

bed2matrix(bedfile, n = NULL, p = NULL)

Arguments

bedfile

Path to a bed file.

n

Number of samples. Default reads it from corresponding fam file.

p

Number of SNPs. Default reads it from corresponding bim file.

Value

An integer matrix.

Examples

bedfile <- system.file("extdata", "geno3pops.bed", package = "pcadapt")
mat <- bed2matrix(bedfile)
dim(mat)
table(mat)

pcadapt documentation built on Aug. 29, 2023, 5:07 p.m.