popsub: Subset data by population

Description Usage Arguments Value Author(s) Examples

View source: R/data_subset.r

Description

Create a new dataset with specified populations or exclude specified populations from the dataset.

Usage

1
2
popsub(gid, sublist = "ALL", blacklist = NULL, mat = NULL,
  drop = TRUE)

Arguments

gid

a genind, genclone, genlight, or snpclone object.

sublist

a vector of population names or indexes that the user wishes to keep. Default to "ALL".

blacklist

a vector of population names or indexes that the user wishes to discard. Default to NULL.

mat

a matrix object produced by mlg.table to be subsetted. If this is present, the subsetted matrix will be returned instead of the genind object

drop

logical. If TRUE, unvarying alleles will be dropped from the population.

Value

A genind object or a matrix.

Author(s)

Zhian N. Kamvar

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# Load the dataset microbov.
data(microbov)

# List the population names.
popNames(microbov)

# Analyze only the populations with exactly 50 individuals
mic.50 <- popsub(microbov, sublist=c(1:6, 11:15), blacklist=c(3,4,13,14))

## Not run: 
# Analyze the first 10 populations, except for "Bazadais"
mic.10 <- popsub(microbov, sublist=1:10, blacklist="Bazadais")

# Take out the two smallest populations
micbig <- popsub(microbov, blacklist=c("NDama", "Montbeliard"))

# Analyze the two largest populations
miclrg <- popsub(microbov, sublist=c("BlondeAquitaine", "Charolais"))

## End(Not run)

poppr documentation built on Aug. 22, 2018, 5:03 p.m.