read.bed: Read the binary PLINK format (BED, BIM, and FAM)

View source: R/plinkformat.R

read.bedR Documentation

Read the binary PLINK format (BED, BIM, and FAM)

Description

Require the complete set of 3 files in the binary PLINK format. It includes BED file, BIM file and BAM file. For more information about the binary PLINK format, please check in the manual of PLINK.

Usage

read.bed(bed, bim, fam, only.snp = FALSE)

Arguments

bed

A path of BED file

bim

A path of BIM file

fam

A path of FAM file

only.snp

If TRUE, the function to read only SNP matrix, otherwise all files are loaded. The default value is FALSE.

Details

For more details about the binary PLINK format, please check http://zzz.bwh.harvard.edu/plink/binary.shtml

Value

The list containing the matrices of $snp, $snp.info, and $ind.info.

  • $snp is a SNP matrix from BED file.

  • $snp.info is a data.frame of SNP information from BIM file.

  • $ind.info is a data.frame of individual information from FAM file.

See Also

write.bed

Examples


#Use the example files embedded in the package.
bed <- system.file("extdata", "example_SNP.bed", package="KRIS")
bim <- system.file("extdata", "example_SNP.bim", package="KRIS")
fam <- system.file("extdata", "example_SNP.fam", package="KRIS")
snp <- read.bed(bed, bim, fam )

#Check the objects inside 'snp'
ls(snp)

#Preview $snp
print(snp$snp[1:10, 1:10])

#Preview $snp.info
head(snp$snp.info)

#Preview $ind.info
head(snp$ind.info)

kridsadakorn/kris documentation built on April 28, 2022, 4:23 a.m.