Learn R Programming

strataG (version 1.0.5)

idRows: gtypes ID Rows

Description

Return lookup matrix of row numbers or row names of @loci slot for sample ids.

Usage

idRows(g, ids = NULL, as.names = FALSE)

Arguments

g
a gtypes object.
ids
character vector of sample ids. If NULL, returns marix of all ids.
as.names
FALSE returns numeric matrix of row numbers. TRUE returns character matrix of rownames.

Value

a matrix of rownames or row numbers for sample ids in the loci slot of a gtypes object.

Examples

Run this code
data(msats.g)

# lookup table of all samples by number
by.num <- idRows(msats.g)
head(by.num)

# lookup table of all samples by name
by.name <- idRows(msats.g, as.name = TRUE)
head(by.name)

# lookup table of selected ids
ran.ids <- sample(indNames(msats.g), 5)
ran.by.num <- idRows(msats.g, ids = ran.ids, as.name = TRUE)
ran.ids

Run the code above in your browser using DataLab