contrasts_to_venn_setlists | R Documentation |
Convert contrast names to Venn setlists for visual comparison
contrasts_to_venn_setlists(
contrast_names = NULL,
sestats = NULL,
sedesign = NULL,
include_multifactor = TRUE,
include_singlefactor = TRUE,
factor_names = NULL,
contrast_style = c("contrast", "comp", "factors"),
max_venn_size = 4,
verbose = FALSE,
...
)
contrast_names |
|
sestats |
|
sedesign |
|
include_multifactor |
|
include_singlefactor |
|
contrast_style |
|
max_venn_size |
|
verbose |
|
... |
additional arguments are passed to |
This function is still under active development to be improved, feedback is welcomed.
The motivation is to take a set of contrast names, and return reasonable subsets of contrasts suitable for visual comparison using Venn diagrams. Ultimately, the process is analogous to defining contrasts themselves: keep experimental factors fixed while varying one factor at a time. The difference is that experimental "factors" may themselves involve a comparison.
The process is currently being tested for two-factor design scenarios, and will be extended to handle higher factor designs in future.
Contrasts are converted to data.frame
with contrasts_to_factors()
Each factor column is iterated to produce sets of contrasts as follows:
The factor data.frame
is subset for rows with a comparison
in the factor column.
When include_multifactor=FALSE
(not default) then data is
filtered to remove rows with comparisons in any other factor columns.
When include_singlefactor=FALSE
(not default) then data is
filtered to remove rows with single values in any other factor columns.
The remaining rows are iteratively split using values in the other factor columns.
Remaining rows are also iteratively split by the depth of the contrast, oneway comparisons, and twoway comparisons.
If any subset contains more than max_venn_size
rows, it is first
split by the control factor level in the factor comparison, then
it is split by the depth of the comparison.
In all cases, the resulting sets are split into subsets with
size max_venn_size
.
list
with contrast names suitable for use in Venn diagrams.
Other jam experiment design:
check_sedesign()
,
contrast2comp()
,
contrast_colors_by_group()
,
contrast_names_to_sedesign()
,
contrasts_to_factors()
,
draw_oneway_contrast()
,
draw_twoway_contrast()
,
filter_contrast_names()
,
groups_to_sedesign()
,
plot_sedesign()
,
sedesign_to_factors()
,
validate_sedesign()
group_names <- paste0(
rep(c("UL3", "dH1A", "dH1B"), each=5), "_",
c("Veh", "DEX", "PMA", "SF", "Ins"))
sedesign <- groups_to_sedesign(group_names)
# by default it returns contrast names
venn_setlists <- contrasts_to_venn_setlists(sedesign=sedesign,
include_multifactor=FALSE,
factor_names=c("Genotype", "Treatment"))
jamba::sdim(venn_setlists)
# plot the contrasts included in one particular Venn setlist
par("mfrow"=c(2, 2));
for (n in 1:4) {
setest <- sedesign;
contrast_names(setest) <- venn_setlists[[n]];
plot_sedesign(setest, contrast_style="none")
}
par("mfrow"=c(1, 1))
venn_set_comps <- contrasts_to_venn_setlists(sedesign=sedesign,
contrast_style="comp",
factor_names=c("Genotype", "Treatment"))
venn_set_comps
data.frame(names(venn_set_comps))
venn_set_factors <- contrasts_to_venn_setlists(sedesign=sedesign,
contrast_style="factors",
factor_names=c("Genotype", "Treatment"))
venn_set_factors
data.frame(names(venn_set_factors))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.