Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

fData-utils

Expand or merge feature variables


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

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

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

Base Functions and Classes for Mass Spectrometry and Proteomics

v2.16.1
Artistic-2.0
Authors
Laurent Gatto, Johannes Rainer and Sebastian Gibb with contributions from Guangchuang Yu, Samuel Wieczorek, Vasile-Cosmin Lazar, Vladislav Petyuk, Thomas Naake, Richie Cotton, Arne Smits, Martina Fisher, Ludger Goeminne, Adriaan Sticker and Lieven Clement.
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.