Learn R Programming

gaston (version 1.2)

select.inds: Subsetting from a bed.matrix

Description

Return subset of individuals satisfying a condition.

Usage

select.inds(x, condition)

Arguments

Value

A bed.matrix similar to x, containing the selected individuals only

Details

The conditions can involve global variables, and all variables defined in the data frame x@ped, that is
  • famid,id,father,mother,sex,pheno
  • If basic stats have been computed (seeset.stats),N0,N1,N2,NAs,callrate.

See Also

select.snps, set.stats

Examples

Run this code
# Load data
data(LCT)
x <- as.bed.matrix(LCT.gen, LCT.fam, LCT.bim)
x <- set.stats(x)

# Select individuals with a call rate > 95% 
# and more than 5% of heterozygous genotypes
y <- select.inds(x, callrate > 0.95 & N1/(N0+N1+N2) > 0.05)
y

Run the code above in your browser using DataLab