rpro {sampler} | R Documentation |
Calculate proportion and margin of error (simple random sample)
Description
Calculate proportion and margin of error (simple random sample)
Usage
rpro(df, col_name, ci = 95, na = "", N = 0)
Arguments
df |
object containing data frame on which to perform analysis (e.g. data) |
col_name |
variable in data frame for which you want to calculate proportion and margin of error |
ci |
(optional) confidence level for establishing a confidence interval using z-score (defaults to 95; restricted to 80, 85, 90, 95 or 99 as input) |
na |
(optional) value that you want to filter and exclude (defaults to include everything) |
N |
(optional) population universe (e.g. 10000, nrow(df)); if N value is passed as an argument, margin of error will be calculated using fpc |
Value
Returns table of responses (n), proportions, margins of error, lower and upper bounds by factor for a given variable
References
[1] Sampling Design & Analysis, S. Lohr, 1999, Equation 2.15
Examples
rpro(df=opening, col_name=openTime, ci=95, na="n/a", N=5361)