opportunity_cost_rand_1 <- tibble(
group = c(rep("control", 75), rep("treatment", 75)),
decision = c(
rep("buy video", 46), rep("not buy video", 29),
rep("buy video", 51), rep("not buy video", 24)
)
) |>
mutate(
group = as.factor(group),
decision = as.factor(decision)
)
opportunity_cost_rand_1 |>
count(group, decision) |>
pivot_wider(names_from = decision, values_from = n) |>
janitor::adorn_totals(where = c("col", "row")) |>
kbl(linesep = "", booktabs = TRUE) |>
kable_styling(
bootstrap_options = c("striped", "condensed"),
full_width = FALSE
) |>
add_header_above(c(" " = 1, "decision" = 2, " " = 1)) |>
column_spec(1:4, width = "7em")