View source: R/chi_squared_test_pairwise.R
chi_squared_test_pairwise | R Documentation |
Conducts a chi-squared test for every possible pairwise comparison with Bonferroni correction
chi_squared_test_pairwise(
data = NULL,
iv_name = NULL,
dv_name = NULL,
focal_dv_value = NULL,
contingency_table = TRUE,
contingency_table_sigfigs = 2,
percent_and_total = FALSE,
percentages_only = NULL,
counts_only = NULL,
sigfigs = 3,
chi_sq_test_stats = FALSE,
correct = TRUE,
save_as_png = FALSE,
png_name = NULL,
width = 2000,
height = 800,
units = "px",
res = 200,
layout_matrix = NULL
)
data |
a data object (a data frame or a data.table) |
iv_name |
name of the independent variable (must be a categorical variable) |
dv_name |
name of the dependent variable (must be a binary variable) |
focal_dv_value |
focal value of the dependent variable whose frequencies will be calculated (i.e., the value of the dependent variable that will be considered a "success" or a result of interest) |
contingency_table |
If |
contingency_table_sigfigs |
number of significant digits that the contingency table's percentage values should be rounded to (default = 2) |
percent_and_total |
logical. If |
percentages_only |
tabulate percentages of the focal DV value only |
counts_only |
tabulate counts of the focal DV value only |
sigfigs |
number of significant digits to round to |
chi_sq_test_stats |
if |
correct |
logical. Should continuity correction be applied? (default = TRUE) |
save_as_png |
if |
png_name |
name of the PNG file to be saved. By default, the name will be "chi_sq_" followed by a timestamp of the current time. The timestamp will be in the format, jan_01_2021_1300_10_000001, where "jan_01_2021" would indicate January 01, 2021; 1300 would indicate 13:00 (i.e., 1 PM); and 10_000001 would indicate 10.000001 seconds after the hour. |
width |
width of the PNG file (default = 2000) |
height |
height of the PNG file (default = 800) |
units |
the units for the |
res |
The nominal resolution in ppi which will be recorded
in the png file, if a positive integer. Used for units
other than the default. By default, |
layout_matrix |
The layout argument for arranging section
titles and tables using the |
chi_squared_test_pairwise(data = mtcars, iv_name = "vs", dv_name = "am")
chi_squared_test_pairwise(data = mtcars, iv_name = "vs", dv_name = "am",
percentages_only = TRUE)
# using 3 mtcars data sets combined
chi_squared_test_pairwise(
data = rbind(mtcars, rbind(mtcars, mtcars)),
iv_name = "cyl", dv_name = "am")
# include the total counts
chi_squared_test_pairwise(
data = rbind(mtcars, rbind(mtcars, mtcars)),
iv_name = "cyl", dv_name = "am", percent_and_total = TRUE)
# display counts
chi_squared_test_pairwise(
data = rbind(mtcars, rbind(mtcars, mtcars)),
iv_name = "cyl", dv_name = "am", contingency_table = "counts")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.