stack_contrasts | R Documentation |
Stack a vector of contrasts into a full string
stack_contrasts(imgroups, contrast_delim = "-", ...)
imgroups |
|
contrast_delim |
|
... |
additional arguments are ignored. |
This is an internal function called by contrast2comp()
and
comp2contrast()
. It takes a single vector of groups, with
2^(integer) number of entries, and combines them into a
series of pairwise contrasts.
character
vector with fully written contrasts.
stack_contrasts(head(LETTERS, 2))
stack_contrasts(head(LETTERS, 4))
stack_contrasts(head(LETTERS, 8))
contrast2comp(stack_contrasts(head(LETTERS, 16)))
# more typical case
stacked <- stack_contrasts(c("KO_Treated", "KO_Control",
"WT_Treated", "WT_Control"))
stacked
# this contrast can be rewritten as a "comp"
stacked_comp <- contrast2comp(stacked)
stacked_comp
# of course the "comp" can be converted back to full contrast name
comp2contrast(stacked_comp)
# note when the contrast cannot be stacked, an error is thrown
tryCatch({
stack_contrasts(head(LETTERS, 5))
}, error=function(e){
print(e)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.