Create, or test for, objects of type projectable_col_freq
.
A numeric vector of pre-calculated frequencies or a vector which sums to a frequency
A numeric vector of pre-calculated base frequencies or a vector which sums to a base frequency
A numeric vector of proportions, defaults to the quotient of n
and
N
A numeric vector of weights for calculating weighted frequencies.
A logical flagging whether or not n
and N
are being
supplied in summarised form or not. If FALSE, n
and N
will be summed
across to calculate frequencies.
An object to test
An S3 vector of class projectable_col_freq
# Calculate and store the frequency of manual cars in `mtcars` data set
col_freq(mtcars$vs %in% 1, mtcars$vs %in% 0:1)
#> <col_freq[1]>
#> [1] 0.44
# Pre-calculate a range of frequencies and store them
dummy_data <- lapply(1:5, function(x) runif(100))
little_n <- vapply(dummy_data, function(x) sum(x >= 0.5), integer(1))
big_n <- vapply(dummy_data, length, integer(1))
col_freq(little_n, big_n, summarised = TRUE)
#> <col_freq[5]>
#> [1] 0.52 0.51 0.45 0.54 0.39