calc_phase_pairs: Calculate phase pair numbers

Description Usage Arguments Value Examples

View source: R/data-processing.R

Description

Calculates a vector containing a unique phase number for every sequential occurrence of a phase or treatment condition. This is useful for creating a grouping variable to be used in calculating effect sizes for each pair of A-B phases within treatment reversal designs.

Usage

1

Arguments

x

vector of phase/condition labels.

Value

A vector containing an integer phase number for every observation.

Examples

1
2
3
4
5
6
7
x <- rep(c("A","B","C","B","C","A","C"), c(4:10))
calc_phase_pairs(x)

library(dplyr)
Schmidt2007 %>% 
  group_by(Behavior_type, Case_pseudonym) %>%
  mutate(phase_pair = calc_phase_pairs(Condition))

SingleCaseES documentation built on Sept. 30, 2021, 5:09 p.m.