Expand or merge feature variables
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.
expandFeatureVars(x, fcol, prefix) mergeFeatureVars(x, fcol, fcol2)
x |
An object of class |
fcol |
A |
prefix |
A |
fcol2 |
A |
An MSnSet
for expanded (merged) feature variables.
Laurent Gatto
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)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.