Description Usage Arguments Value Examples

View source: R/data-processing.R

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.

1 |

`x` |
vector of phase/condition labels. |

A vector containing an integer phase number for every observation.

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))
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.