Description Usage Arguments Value Examples
Loads genotype data from PLINK format files .bed, .bim, and .fam.
1 |
bed |
the name of the bed file. |
bim |
the name of the bim file. For a SNP without a rs number, use any character (including any white space or '.') in the second column of the bim file. |
fam |
the name of the fam file. |
sel.snps |
a character vector of SNPs to be extracted from the plink files. The default is |
sel.subs |
an optional character vector specifying a subset of subject IDs to be extracted from the plink files. These IDs should be matched with the second column of |
encode012 |
logical. Encoding the genotypes using 0/1/2 if |
A data frame of genotypes of specified subjects in the plink files. For a SNP in sel.snps
specified in the format Chr:Pos
, e.g. 13:234567, it will be named to be C13P234567 in the returned data frame.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # Load the sample data
bed <- system.file("extdata", package = 'ARTP2', 'chr1.bed')
bim <- system.file("extdata", package = 'ARTP2', 'chr1.bim')
fam <- system.file("extdata", package = 'ARTP2', 'chr1.fam')
## first five SNPs
b <- read.table(bim, header = FALSE, as.is = TRUE, nrows = 5)
## first 50 subjects
f <- read.table(fam, header = FALSE, as.is = TRUE, nrows = 50)
geno <- read.bed(bed, bim, fam, sel.snps = b[, 2], sel.subs = f[, 2])
dim(geno) # 50 x 5
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.