Learn R Programming

SeqVarTools (version 1.10.0)

meanBySample: Mean value by sample

Description

Calculate the mean value of a variable by sample over all variants

Usage

"meanBySample"(gdsobj, var.name, use.names=FALSE)

Arguments

gdsobj
A SeqVarGDSClass object with VCF data.
var.name
Character string with name of the variable, most likely "annotation/format/VARIABLE_NAME".
use.names
A logical indicating whether to assign sample IDs as names of the output vector.

Value

A numeric vector of mean values.

Details

Mean values by variant can be calculated using seqApply(gdsobj, var.name, mean, na.rm=TRUE). Currently seqApply can only be used with the option margin="by.variant". This method provides a way to calculate mean values by sample.

See Also

SeqVarGDSClass, applyMethod, seqApply

Examples

Run this code
gds <- seqOpen(seqExampleFileName("gds"))
head(meanBySample(gds, "annotation/format/DP", use.names=TRUE))
seqClose(gds)

Run the code above in your browser using DataLab