powered by
add_up_to_map() applies add_up_to() to every row of a data frame.
add_up_to_map()
add_up_to()
Call audit() on the output for summary statistics.
audit()
add_up_to_map(data, summands, total = NULL, ...)
A tibble with the summands columns, total, consistency, and any other columns from data, with the class scrutiny_add_up_to_map.
summands
total
consistency
data
scrutiny_add_up_to_map
Data frame with a total column and the columns to add up. Any other columns are returned alongside the results.
Columns of data to add up, selected with tidyselect, such as starts_with("n_"). There is no default.
starts_with("n_")
Optionally, the name of the column in data that contains the totals, if it isn't total.
These dots must be empty.
audit() on add_up_to_map() output returns a tibble with one row and these columns:
all_cases: total number of rows.
all_cases
incon_cases: number of inconsistent rows.
incon_cases
emp_incon: proportion of inconsistent rows.
emp_incon
df <- tibble::tibble( n_control = c(40, 25, 31), n_treatment = c(37, 26, 30), n_waitlist = c(43, 24, 30), total = c(120, 75, 90) ) df |> add_up_to_map(summands = starts_with("n_"))
Run the code above in your browser using DataLab