add_prop_test: Add results of prop.test to data frame
Description
Adds prop.test results as columns to data frame based on data in columns
For use with a tibble in a pipe:
Using one-group prop.test, adds confidence intervals (with given conf.level)
for the proportion of x positive results in n trials,
and the p value that the proportion is equal to p (default: 0.5)
(to add the estimated proportion itself, use count_by)
Usage
add_prop_test(
.df,
x,
n,
p = NULL,
CI_lower_name = "CI_lower",
CI_upper_name = "CI_upper",
p_name = "p",
alternative = c("two.sided", "less", "greater"),
conf.level = 0.95,
correct = TRUE
)
Arguments
.df
A data frame
x
The column/vector with the number of positive results
n
The column/vector/constant with the number of trials
p
Assumed proportion: Will add a p-value that the proportion is equal to p (default: 0.5)