Make contingency table with chi-square test of independence
Usage
apa_chisq(
data,
note = NULL,
row_title_column = NULL,
row_title_prefix = "",
row_title_sep = " ",
row_title_align = "center",
row_title_border = list(color = "gray20", style = "solid", width = 1),
left_column_padding = 20,
cwidth = 0.75,
cheight = 0.25,
separate_headers = TRUE,
apa_style = TRUE,
font_family = NULL,
font_size = 12,
text_color = "black",
border_color = "black",
border_width = 0.5,
line_spacing = 2,
horizontal_padding = 3,
table_align = "left",
layout = "autofit",
table_width = 1,
markdown = TRUE,
markdown_header = markdown,
markdown_body = markdown,
auto_format_columns = TRUE,
column_formats = NULL,
pretty_widths = TRUE,
suppress_warnings = TRUE,
...
)
Arguments
- data
A two-column data.frame or tibble
- note
Custom note (overrides automatic note.)
- row_title_column
Column name or tidyselect function. column to group rows
- row_title_prefix
text to be added to each title
- row_title_sep
separator for prefix
- row_title_align
alignment of row title ("left", "center", "right")
- row_title_border
list of flextable styles
- left_column_padding
Number of points the left column is padded (only relevant when there is a
row_title_column
androw_title_align = "left"
)- cwidth
initial cell width in inches
- cheight
initial cell height in inches
- separate_headers
separate header rows (default:
TRUE
)- apa_style
apply
apa_style
function (default:TRUE
)- font_family
font family
- font_size
font size
- text_color
text color
- border_color
border color
- border_width
border width in pixels
- line_spacing
spacing between lines
- horizontal_padding
horizontal padding (in pixels)
- table_align
table alignment ("left", "center", "right")
- layout
table layout ("autofit", "fixed")
- table_width
table width (in pixels, 0 for auto)
- markdown
apply markdown formatting to header and body
- markdown_header
apply markdown formatting to header
- markdown_body
apply markdown formatting to body
- auto_format_columns
if true, will attempt to format some columns automatically
- column_formats
a column_formats object
- pretty_widths
apply
pretty_widths
function- suppress_warnings
Suppress any warnings if true.
- ...
arguments passed to
apa_style
Examples
apa_chisq(mtcars[, c("am", "gear")])
gear
0
1
n
%
n
%
3
15
78.9%
0
0.0%
4
4
21.1%
8
61.5%
5
0
0.0%
5
38.5%
Note. χ2 (2) = 20.94, p < .001, Adj. Cramer’s V = .78