Conduct a binomial test. In other words, test whether an observed proportion of "successes" (e.g., proportion of heads in a series of coin tosses) is greater than the expected proportion (e.g., 0.5). This function uses the 'binom.test' function from the 'stats' package.
binomial_test( x =NULL, success =NULL, failure =NULL, p =0.5, alternative ="two.sided", ci =0.95, round_percentages =0)
Arguments
x: a vector of values, each of which represents an instance of either a "success" or "failure" (e.g., c("s", "f", "s", "s", "f", "s"))
success: which value(s) indicate "successes"?
failure: (optional) which value(s) indicate "failures"? If no input is provided for this argument, then all the non-NA values that are not declared to be "successes" will be treated as "failures".
p: hypothesized probability of success (default = 0.5)
alternative: indicates the alternative hypothesis and must be one of "two.sided", "greater", or "less". You can specify just the initial letter. By default, alternative = "two.sided"
ci: width of the confidence interval (default = 0.95)
round_percentages: number of decimal places to which to round the percentages in the summary table (default = 0)