fData-utils: Expand or merge feature variables

Description Usage Arguments Value Author(s) Examples

Description

The expandFeatureVars and mergeFeatureVars respectively expand and merge groups of feature variables. Using these functions, a set of columns in a feature data can be merged into a single new data.frame-column variables and a data.frame-column can be expanded into single feature columns. The original feature variables are removed.

Usage

1
2
3
expandFeatureVars(x, fcol, prefix)

mergeFeatureVars(x, fcol, fcol2)

Arguments

x

An object of class MSnSet.

fcol

A character() of feature variables to expand (for expandFeatureVars) or merge (for mergeFeatureVars).

prefix

A character(1) to use as prefix to the new feature variables. If missing (default), then fcol is used instead. If NULL, then no prefix is used.

fcol2

A character(1) defining the name of the new feature variable.

Value

An MSnSet for expanded (merged) feature variables.

Author(s)

Laurent Gatto

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
library("pRolocdata")
data(hyperLOPIT2015)
fvarLabels(hyperLOPIT2015)
## Let's merge all svm prediction feature variables
(k <- grep("^svm", fvarLabels(hyperLOPIT2015), value = TRUE))
hl <- mergeFeatureVars(hyperLOPIT2015, fcol = k, fcol2 = "SVM")
fvarLabels(hl)
head(fData(hl)$SVM)

## Let's expand the new SVM into individual columns
hl2 <- expandFeatureVars(hl, "SVM")
fvarLabels(hl2)
## We can set the prefix manually
hl2 <- expandFeatureVars(hl, "SVM", prefix = "Expanded")
fvarLabels(hl2)
## If we don't want any prefix
hl2 <- expandFeatureVars(hl, "SVM", prefix = NULL)
fvarLabels(hl2)

MSnbase documentation built on Jan. 23, 2021, 2 a.m.