
Weighted crosstabulation tables exported to Excel.
tabbitR automates the production of large sets of weighted crosstabulation tables and exports them directly to Excel. It is designed for situations where analysts need many tables at once:
This is a common and time-consuming task in survey research, monitoring and evaluation work, and exploratory data analysis. Doing it manually is slow, repetitive, and error-prone.
tabbitR solves this by generating a full and consistent set of tables in a single command. For each outcome by breakdown pair, it writes:
User options control:
You can install the development version of tabbitR from GitHub with pak:
install.packages("pak")
pak::pak("smmcandrew/tabbitR")or with remotes:
remotes::install_github("smmcandrew/tabbitR")Below is a minimal example using toy data.
library(tabbitR)
df <- data.frame(
outcome = factor(c("A", "B", "A", NA, "C", NA)),
sex = factor(c("Male", "Male", "Female", "Female", "Prefer not to say", "Male")),
weight = c(1, 2, 1, 1, 0.75, 3)
)
tabbit_excel(
data = df,
vars = "outcome",
breakdown = "sex",
wtvar = "weight",
file = "example_output.xlsx",
decimals = 2
)This will create an Excel workbook with a weighted percentage table and unweighted N table for each frequency or breakdown, automatically formatted and labelled.
This README is generated from README.Rmd. Use:
devtools::build_readme()