Create contrast matrix
contrast_matrix(R, ref, name = 1:R)
the number of column for the contrast matrix
the reference group. It could be a number between 1,..., R, R is number of conditions, or the name of reference group. If there is no reference group, it can be the string 'mean'.
a length R vector contains the name for conditions
contrast_matrix(5, 'mean')
#> 1 2 3 4 5
#> 1-mean 0.8 -0.2 -0.2 -0.2 -0.2
#> 2-mean -0.2 0.8 -0.2 -0.2 -0.2
#> 3-mean -0.2 -0.2 0.8 -0.2 -0.2
#> 4-mean -0.2 -0.2 -0.2 0.8 -0.2
#> attr(,"reference")
#> [1] "mean"