Skip to contents

Sets +1 for the first condition and -1 for the second in a zero vector. Used as a building block for contrast design matrices.

Usage

makePairwiseContrastCol(pair, template)

Arguments

pair

A length-2 character vector naming the two conditions to contrast.

template

A named numeric vector of zeros with names matching all conditions.

Value

The template vector with +1 at pair[1] and -1 at pair[2].

Examples

makePairwiseContrastCol(c("a", "b"), "mean_contrast_")
#>                                 a                b 
#> "mean_contrast_"              "1"             "-1"