featureCV {MSnbase} | R Documentation

## Calculates coeffivient of variation for features

### Description

This function calculates the column-wise coefficient of variation (CV), i.e. the ration between the standard deviation and the mean, for the features in an `MSnSet`. The CVs are calculated for the groups of features defined by `groupBy`. For groups defined by single features, `NA` is returned.

### Usage

    featureCV(x, groupBy, na.rm = TRUE, norm = "none", suffix = NULL)

### Arguments

`x` | An instance of class `MSnSet`.
`groupBy` | An object of class `factor` defining how to summarise the features.
`na.rm` | A `logical(1)` defining whether missing values should be removed.
`norm` | One of normalisation methods applied prior to CV calculation. See `normalise()` for more details. Here, the default is `'none'`, i.e. no normalisation.
`suffix` | A `character(1)` to be used to name the new CV columns. Default is `NULL` to ignore this. This argument should be set when CV values are already present in the `MSnSet` feature variables.

### Value

A `matrix` of dimensions `length(levels(groupBy))` by `ncol(x)` with the respecive CVs. The column names are formed by pasting `CV.` and the sample names of object `x`, possibly suffixed by `.suffix`.

### Author(s)

Laurent Gatto and Sebastian Gibb

### See Also

`combineFeatures()`

### Examples

    data(msnset)
    msnset <- msnset[1:4]
    gb <- factor(rep(1:2, each = 2))
    featureCV(msnset, gb)
    featureCV(msnset, gb, suffix = "2")

[Package MSnbase version 2.20.1 Index]