matchSampToPairw {wrMisc} | R Documentation |
Match names to concatenated pairs of names
Description
The column-names of multiple pairwise testing contain the names of the initial groups/conditions tested, plus there is a separator (eg '-' in moderTestXgrp
).
Thus function allows to map back which groups/conditions were used by returning the index of the respective groups used in pair-wise sets.
Usage
matchSampToPairw(
grpNa,
pairwNa,
sep = NULL,
silent = FALSE,
debug = FALSE,
callFrom = NULL
)
Arguments
grpNa |
(character) the names of the groups of replicates (ie conditions) used to test |
pairwNa |
(character) the names of pairwise-testing (ie 'concatenated' |
sep |
(character) if not |
silent |
(logical) suppress messages |
debug |
(logical) additional messages for debugging |
callFrom |
(character) allow easier tracking of messages produced |
Details
There are two modes of operation : 1) Argument sep
is set to NULL
: The names of initial groups/conditions (grpNa
)
will be tested for exact pattern matching either at beginning or at end of pair-wise names (pairwNa
).
This approach has the advantage that it does not need to be known what character(s) were used as separator (or they may change),
but the disadvantage that in case the perfect grpNa
was not given, the longest best match of grpNa
will be returned.
2) The separator sep
is given and exact matches at both sides will be searched.
However, if the character(s) from sep
do appear inside grpNa
no matches will be found.
If some grpNa
are not found in pairwNa
this will be marked as NA.
Value
matrix of 2 columns with inidices of sampNa
with pairwNa
as rows
See Also
(for running multiple pair-wise test) moderTestXgrp
, grep
, strsplit
Examples
pairwNa1 <- c("abc-efg","abc-hij","efg-hij")
grpNa1 <- c("hij","abc","abcc","efg","klm")
matchSampToPairw(grpNa1, pairwNa1)
pairwNa2 <- c("abc-efg","abcc-hij","abc-hij","abc-hijj","zz-zz","efg-hij")
matchSampToPairw(grpNa1, pairwNa2)