I have pairs of variables with the following naming convention:

variablename1, variablename1_t2,

variablename2, variablename2_t2,

variablenameX, variablenameX_t2, and so on.

For exploration I would like to calculate the difference between each of the variable pairs (variablenameX_t2 - variablenameX) and use the crosstable by function with automatic effect sizes and test statistics.

Any ideas? E.g. how to run through /map the variables, e.g. mutate into new variables (variablenameX_diff) ?

Or can it be done "on the fly" with crosstable?

```
crosstable(df, c(ends_with("_diff")),
by=c(comparison_variable_of_interest),
unique_numeric = 5,
percent_digits=2,
percent_pattern="{n} ({p_col})",
total="both",
showNA="ifany",
effect = TRUE, test = TRUE) %>%
as_flextable(keep_id=TRUE, compact=TRUE, header_show_n=1)
```