Skip to contents

Construct pairwise contrasts for all combinations of factor levels.

Usage

pairwise_contrasts(levels, where = NULL)

Arguments

levels

A vector of factor levels to be compared.

where

An optional formula specifying the subset over which the contrast is computed.

Value

A contrast_set object containing pairwise contrasts for all combinations of factor levels.

Examples

pairwise_contrasts(c("A", "B", "C"))
#> [[1]]
#> $A
#> ~A
#> <environment: 0x7f8f66a215a8>
#> 
#> $B
#> ~B
#> <environment: 0x7f8f66a215a8>
#> 
#> $where
#> NULL
#> 
#> $name
#> [1] "con_A_B"
#> 
#> attr(,"class")
#> [1] "pair_contrast_spec" "contrast_spec"      "list"              
#> 
#> [[2]]
#> $A
#> ~A
#> <environment: 0x7f8f66a2e950>
#> 
#> $B
#> ~C
#> <environment: 0x7f8f66a2e950>
#> 
#> $where
#> NULL
#> 
#> $name
#> [1] "con_A_C"
#> 
#> attr(,"class")
#> [1] "pair_contrast_spec" "contrast_spec"      "list"              
#> 
#> [[3]]
#> $A
#> ~B
#> <environment: 0x7f8f66a390f8>
#> 
#> $B
#> ~C
#> <environment: 0x7f8f66a390f8>
#> 
#> $where
#> NULL
#> 
#> $name
#> [1] "con_B_C"
#> 
#> attr(,"class")
#> [1] "pair_contrast_spec" "contrast_spec"      "list"              
#> 
#> attr(,"class")
#> [1] "contrast_set" "list"