subset.mppData {mppR}R Documentation

Subset mppData object

Description

Pull out a specified set of markers and/or genotypes from a mppData object.

Usage

## S3 method for class 'mppData'
subset(x, mk.list = NULL, gen.list = NULL, ...)

Arguments

x

An object of class mppData.

mk.list

Optional character vector, numeric position vector or logical vector representing marker to keep. Default = NULL.

gen.list

Optional character vector, numeric position vector or logical vector representing genotypes to keep. Default = NULL.

...

Ignored.

Value

Return:

The mppData object but with only the specified subset of data.

Author(s)

Vincent Garin

Examples


### Marker subset

data(mppData)

# Random selection of markers
mk.list <-  sample(mppData$map[, 1], 50)
mppData_sub <- subset(x = mppData, mk.list = mk.list)

# Selection of chromosome 1 marker
mk.list <-  (mppData$map[, 2] == 1)
mppData_sub <- subset(x = mppData, mk.list = mk.list)

### Genotype subset

# Random selection of genotypes
gen.list <-  sample(mppData$geno.id, 200)
mppData_sub <- subset(x = mppData, gen.list = gen.list)

# Selection of genotype from cross 2 and 5
crosses <- unique(mppData$cross.ind)
gen.list <-  mppData$geno.id[mppData$cross.ind %in% crosses[c(2, 5)]]
mppData_sub <- subset(x = mppData, gen.list = gen.list)

### Marker and genotype subset

mk.list <-  sample(mppData$map[, 1], 50)
gen.list <-  sample(mppData$geno.id, 200)
mppData_sub <- subset(x = mppData, mk.list = mk.list,
gen.list = gen.list)


[Package mppR version 1.5.0 Index]