View source: R/group_features.R
groupToSinglePolarityPairs  R Documentation 
Based on a grouping f
and the polarity of each element polarity
, the
function ensures each feature group to consist of only a single
positive/negative feature pair. Thus, each of the groups in f
is further
subgrouped into positive/negative feature pairs with the highest correlation
of feature values across samples. In the returned grouping no group will
have more than one feature of the same polarity.
This function can be helpful for merging feature grouping results from positive and negative polarity.
groupToSinglePolarityPairs(f, polarity = rep(1, length(f)), fvals)
f 
vector defining the initial grouping of elements (e.g. such as
returned by 
polarity 
vector (same length than 
fvals 

factor
with the grouping, ensuring that each group consists of only
a single positive/negative pair.
Johannes Rainer
Other grouping operations:
groupByCorrelation()
## Define a simple matrix where the first 4 and the last 3 rows are highly ## correlated with each other. x < rbind( c(4, 3, 5, 1), c(4, 2, 5, 1), c(4, 3, 4, 1), c(4, 3, 4, 1), c(4, 4, 4, 9), c(4, 4, 4, 9), c(4, 4, 4, 9)) ## Determin the expected grouping by correlation grp < groupByCorrelation(x) grp ## Each second row represents however a feature measured in a different ## polarity. From another grouping (e.g. based on EIC correlation) we know ## however that none of the positive polarity features should be ## grouped together. We apply now the function to further subgroup `grp` ## keeping only single positive/negative pairs in each group of `grp`. pol < c("NEG", "POS", "NEG", "POS", "NEG", "POS", "NEG") groupToSinglePolarityPairs(grp, pol, x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.