makeListOfComparisons.Rd
Construct a list defining the pairwise group comparisons that will be performed.
makeListOfComparisons(
allGroups,
comparisons,
mergeGroups = list(),
allPairwiseComparisons,
ctrlGroup,
discardGroup = NULL
)
Character vector containing all group labels in the dataset.
List of length-2 character vectors defining comparisons
to perform. The first element of each vector represents the
denominator of the comparison, the second the numerator.
If comparisons
is non-empty, ctrlGroup
and
allPairwiseComparisons
are ignored. If one of the two elements
in the vector is "complement", it will be created as the complement
of the other group.
Named list defining groups to merge. Each entry of the
list corresponds to a new group, and consists of a vector with the
original group names (a subset of allGroups
). Only comparisons
contrasting non-overlapping sets of groups will be performed.
Logical scalar, whether all pairwise comparisons shall be performed.
Character scalar defining the sample group to use as control group in comparisons.
Character vector. Any comparison including any of these groups will be discarded.
A list with two elements:
comparisons
- a list of vectors of length 2, indicating
the pairwise group comparisons.
groupComposition
- a list specifying the composition of
each group label used in comparisons
, in terms of the original
group names. This is used to keep track of the composition of merged
groups.
## Perform all pairwise comparisons
makeListOfComparisons(allGroups = c("g1", "g2", "g3"),
comparisons = list(), mergeGroups = list(),
allPairwiseComparisons = TRUE,
ctrlGroup = "g1")
#> $comparisons
#> $comparisons$g2_vs_g1
#> [1] "g1" "g2"
#>
#> $comparisons$g3_vs_g1
#> [1] "g1" "g3"
#>
#> $comparisons$g3_vs_g2
#> [1] "g2" "g3"
#>
#>
#> $groupComposition
#> $groupComposition$g1
#> [1] "g1"
#>
#> $groupComposition$g2
#> [1] "g2"
#>
#> $groupComposition$g3
#> [1] "g3"
#>
#>
## Pre-specify the comparisons
makeListOfComparisons(allGroups = c("g1", "g2", "g3"),
comparisons = list(c("g1", "g3")),
mergeGroups = list(),
allPairwiseComparisons = TRUE,
ctrlGroup = "g1")
#> $comparisons
#> $comparisons$g3_vs_g1
#> [1] "g1" "g3"
#>
#>
#> $groupComposition
#> $groupComposition$g1
#> [1] "g1"
#>
#> $groupComposition$g2
#> [1] "g2"
#>
#> $groupComposition$g3
#> [1] "g3"
#>
#>
## Compare each group to its complement
makeListOfComparisons(allGroups = c("g1", "g2", "g3"),
comparisons = lapply(c("g1", "g2", "g3"),
function(g) c("complement", g)),
mergeGroups = list(),
allPairwiseComparisons = TRUE,
ctrlGroup = "")
#> $comparisons
#> $comparisons$g1_vs_g1_complement
#> [1] "g1_complement" "g1"
#>
#> $comparisons$g2_vs_g2_complement
#> [1] "g2_complement" "g2"
#>
#> $comparisons$g3_vs_g3_complement
#> [1] "g3_complement" "g3"
#>
#>
#> $groupComposition
#> $groupComposition$g1
#> [1] "g1"
#>
#> $groupComposition$g2
#> [1] "g2"
#>
#> $groupComposition$g3
#> [1] "g3"
#>
#> $groupComposition$g1_complement
#> [1] "g2" "g3"
#>
#> $groupComposition$g2_complement
#> [1] "g1" "g3"
#>
#> $groupComposition$g3_complement
#> [1] "g1" "g2"
#>
#>