Learn R Programming

MSnbase (version 1.20.7)

featureCV: 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 = c("sum", "max", "none", "center.mean", "center.median", "quantiles", "quantiles.robust"))

Arguments

x
An instance of class "MSnSet".
groupBy
An object of class factor defining how to summerise the features.
na.rm
A logical defining whether missing values should be removed.
norm
One of 'none' (default), 'sum', 'max', 'center.mean', 'center.median' 'quantiles' or 'quantiles.robust' defining if and how the data should be normalised prior to CV calculation. See normalise for more details.

Value

A matrix of dimensions length(levels(groupBy)) by ncol(x) with the respecive CVs.

See Also

combineFeatures

Examples

Run this code
data(msnset)
msnset <- msnset[1:4]
gb <- factor(rep(1:2, each = 2))
featureCV(msnset, gb)

Run the code above in your browser using DataLab