```
# Phi coefficient for 2x2 tables
tab <- table(sample(1:2, 30, TRUE), sample(1:2, 30, TRUE))
phi(tab)
# Cramer's V for nominal variables with more than 2 categories
tab <- table(sample(1:2, 30, TRUE), sample(1:3, 30, TRUE))
cramer(tab)
# formula notation
data(efc)
cramer(e16sex ~ c161sex, data = efc)
# bootstrapped confidence intervals
cramer(e16sex ~ c161sex, data = efc, ci.lvl = .95, n = 100)
# 2x2 table, compute Phi automatically
crosstable_statistics(efc, e16sex, c161sex)
# more dimensions than 2x2, compute Cramer's V automatically
crosstable_statistics(efc, c172code, c161sex)
# ordinal data, use Kendall's tau
crosstable_statistics(efc, e42dep, quol_5, statistics = "kendall")
# calcilate Spearman's rho, with continuity correction
crosstable_statistics(efc,
e42dep,
quol_5,
statistics = "spearman",
exact = FALSE,
continuity = TRUE
)
```

Run the code above in your browser using DataCamp Workspace