MyNixOS website logo
Description

Weighted Cross-Tabulations Exported to 'Excel'.

Produces weighted cross-tabulation tables for one or more outcome variables across one or more breakdown variables, and exports them directly to 'Excel'. For each outcome-by-breakdown combination, the package creates a weighted percentage table and a corresponding unweighted count table, with transparent handling of missing values and light, readable formatting. Designed to support social survey analysis workflows that require large sets of consistent, publication-ready tables.

tabbitR

Weighted crosstabulation tables exported to Excel.

R-CMD-check License:MIT

Overview

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:

  • multiple outcome variables
  • multiple breakdown (explanatory) variables
  • weighted percentages
  • unweighted counts
  • transparent treatment of missing values.

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:

  • a weighted percentage table
  • a matching unweighted N table
  • clearly labelled reporting of missing values
  • light formatting (headers, borders, bold labels) using {openxlsx}.

User options control:

  • number of decimal places
  • row vs.column percentages
  • whether to show overall % columns or total rows
  • how missing responses should be reported
  • whether to create one sheet per breakdown variable.

Installation

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

Example

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.

Development notes

This README is generated from README.Rmd. Use:

devtools::build_readme()
Metadata

Version

0.1.3

License

Unknown

Platforms (78)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows