krysstabell: Create a cross table showing column percentages

View source: R/krysstabell.R

krysstabellR Documentation

Create a cross table showing column percentages

Description

This function allows you to cross-tabulate two variables in your dataset. The table will show column percentages. The result can be printed in an "export-ready" fashion, meaning it can be copied and pasted into a Word document and there transformed into a publication-quality table. The functions will provide warnings in some cases where user selections might be problematic.

Usage

krysstabell(dataset, rowvar, colvar, export = NULL)

Arguments

dataset

Your dataset (a data.frame-type object).

rowvar

The row-variable.

colvar

The column-variable.

export

Should the result be made export-ready (TRUE/FALSE)?

Value

A matrix or, if export function is switched on (export=TRUE), a printed out table formatted for easy export to MS Word.

Examples

## Not run: 
# Load mtcars dataset
data(mtcars)

# Simple example
krysstabell(dataset = mtcars,
rowvar = "carb",
colvar = "gear")

# For export
krysstabell(dataset = mtcars,
rowvar = "carb",
colvar = "gear",
export = TRUE)

## End(Not run)


cknotz/bst290 documentation built on Nov. 11, 2023, 1 p.m.