Calculate phase-pairs based on phases and session numbering.

phase_pairs(phase, session = seq_along(phase))

## Arguments

phase

vector of treatment indicators or a character or factor vector indicating unique treatment phases.

session

numeric vector of measurement occasions.

## Examples


phases <- rep(c("A","B","A","B"), each = 4)
sessions <- 1:length(phases)

phase_pairs(phases, sessions)
#>  [1] 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2

phases <- rep(c("A","B","C","A","B","C","D"), each = 4)
phase_pairs(phases)
#>  [1] 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2

phases <- rep(c("B","A","C","B","A","B","C","A"), each = 4)
phase_pairs(phases)
#>  [1] 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3