Skip to contents

Main function

crosstable()
Easily describe datasets
crosstable_options()
Options for the package crosstable
crosstable_peek_options()
See which crosstable option is currently set.
crosstable_reset_options()
Reset all crosstable options.

Datasets

Standard datasets, modified to have labels, characters, and factors

iris2
Modified iris dataset
mtcars2
Modified mtcars dataset

Labelling

Handle label attributes (compatible with Hmisc, expss, haven…)

import_labels() save_labels()
Import labels
set_label() copy_label_from()
Set the "label" attribute of an object
get_label()
Get label if wanted and available, or default (name) otherwise
remove_labels()
Remove all label attributes.
apply_labels()
Batch set variable labels
rename_with_labels()
Rename every column of a dataframe with its label
clean_names_with_labels()
Cleans names of a dataframe while retaining old names as labels

Post-processing

Modify an already built crosstable

transpose_crosstable() t(<crosstable>)
Transpose a crosstable
pivot_crosstable()
Pivot a crosstable

Summary functions

Summarise numeric variables

meansd() meanCI() mediqr() minmax() nna()
Summary functions
cross_summary()
Summarize a numeric vector
na()
Return the number of NA observations
N()
Return the number of non NA observations

Visualization

Visualize a crosstable in various formats

as_gt()
Converts a crosstable object into a formatted gt table.
as_workbook()
Converts a crosstable object into a formatted, savable openxlsx workbook.
as_flextable(<crosstable>)
Turns a crosstable object into a formatted flextable

Officer helpers

Used in cooperation with the officer package

body_add_crosstable()
Add a crosstable to an officer document
body_add_crosstable_footnote()
Adds a standard footnote explaining the abbreviations used in a crosstable
body_add_gg2()
Alternative to officer::body_add_gg() which uses ggplot syntax
body_add_img2()
Alternative to officer::body_add_img() which adds a units choice
body_add_table_legend() body_add_figure_legend()
Add a legend to a table or a figure
body_add_list() body_add_list_item()
Add a list to an officer document
body_add_normal()
Add a new paragraph with default style
body_add_table_list() body_add_flextable_list() body_add_crosstable_list()
Add a list of tables
body_add_table_section()
Add a section with a table and its legend
body_add_title()
Add a title to an officer document
body_replace_text_at_bkms()
Replace text on several bookmarks at once
docx_bookmarks2()
List Word bookmarks, including the ones in header and footer
write_and_open()
Alternative to default officer print() function. Write the file and try to open it right away.
generate_autofit_macro()
Generate a macro file for autofitting

Utils

Practical functions for various purposes

get_percent_pattern()
Percent pattern helper
format_fixed()
Format numbers with the exact same number of decimals, including trailing zeros
ct_compact(<data.frame>) ct_compact(<crosstable>)
Generic function to compact a table (publication formatting)
plim()
Format p values (alternative to format.pval())
confint_numeric()
Confidence interval of a numeric vector
narm()
Remove missing values
is.crosstable() is.transposed_crosstable() is.compacted_crosstable() is.multiby_crosstable()
Test if an object is a crosstable
peek()
Open a crosstable in a temporary document

Effects and tests

Default parameters

crosstable_effect_args()
Default arguments for calculating and displaying effects in crosstable()
crosstable_test_args()
Default arguments for calculating and displaying tests in crosstable()

Effects

display_effect()
Default function to display the effect
diff_mean_auto() diff_mean_boot() diff_median_boot() diff_mean_student()
Effect measure for association between one continuous and one categorical variable
effect_survival_coxph()
Effect measure for association between one censored variable and one categorical variable
effect_odds_ratio() effect_relative_risk() effect_risk_difference()
Effect measure for association between two categorical variables

Tests

display_test()
Default function to display a test result
crosstable_test_args()
Default arguments for calculating and displaying tests in crosstable()
test_correlation_auto()
test for correlation coefficients
test_summarize_auto()
test for mean comparison
test_summarize_linear_contrasts()
Test for linear trend across ordered factor with contrasts
test_survival_logrank()
test for survival comparison
test_tabular_auto()
test for contingency table