strsplitOrdered | R Documentation |
Split the elements of an ordered factor vector
strsplitOrdered(
x,
split = "_",
fixed = FALSE,
perl = FALSE,
useBytes = FALSE,
sortFunc = jamba::mixedSort,
keepOrder = TRUE,
...
)
x |
character or factor vector. |
split |
character split value sent to |
fixed , perl , useBytes |
additional arguments sent to |
sortFunc |
function used to sort character values when the input
|
keepOrder |
logical indicating whether to keep the order of values in the input data, for example with character input the values will be ordered by the first appearance of each term. |
... |
additional arguments are ignored. |
This function performs base::strsplit()
while trying to maintain
the order of factor levels in the output, based upon the order of
factor levels in the input data.
list of factor vectors, where each factor shares the same global factor levels based upon the input data.
Other jam string functions:
escapeWhitespaceRegexp()
,
sortSamples()
# first define a vector of sample groups
iGroups <- jamba::nameVector(paste(rep(c("WT", "KO"), each=6),
rep(c("Control", "Treated"), each=3),
sep="_"));
iGroups <- factor(iGroups, levels=unique(iGroups));
iGroups;
strsplitOrdered(iGroups, "_");
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.