Skip to contents

infer_2prop() is an alternative to infer_2prop_test() and infer_2prop_int(). Rather than have hypothesis test and confidence interval output split into two separate functions, you can now do it in one. For just a hypothesis test, do nothing different from infer_2prop_test() (except change the function name). For a confidence interval provided with that, use conf_int = "show".

Usage

infer_2prop(
  data,
  formula,
  success,
  digits = 3,
  conf_lvl = 0.95,
  alternative = c("notequal", "greater", "less"),
  conf_int = c("hide", "show"),
  caption = NULL
)

Arguments

data

A data frame (or tibble).

formula

The variables to run the test on, in formula syntax, var1 ~ var2.

success

The data value that constitutes a "success".

digits

The number of digits to round table values to. Defaults to 3.

conf_lvl

The confidence level of the interval, entered as a value between 0 and 1. Defaults to 0.95.

alternative

The alternative hypothesis. Defaults to "notequal" (two sided p-value). Other options include "greater" or "less". Use depends on your test.

conf_int

Should a confidence interval be provided in addition to the hypothesis test output? Defaults to "hide" with the other option being "show".

caption

An override to the table caption. A sensible default is provided.

Value

An object of class flextable. In interactive sessions, output is viewable immediately.

Examples

infer_2prop(mtcars, vs~am, success = 1)
infer_2prop(mtcars, vs~am, success = 1, conf_lvl = .9, digits = 4)
infer_2prop(mtcars, vs~am, success = 1, conf_lvl = .9, digits = 5, conf_int = "show")