meanBySample {SeqVarTools} | R Documentation

## Mean value by sample

### Description

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

### Usage

    ## S4 method for signature 'SeqVarGDSClass'
    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.

### 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.

### Value

A numeric vector of mean values.

### Author(s)

Stephanie Gogarten

### See Also

`SeqVarGDSClass`, `applyMethod`, `seqApply`

### Examples

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

[Package SeqVarTools version 1.24.1 Index]