library(dplyr, warn.conflicts = FALSE)
df <- tibble(
a = c(1, 1, 2, 2),
x = rvec(list(1:2, 3:4, 5:6, 7:8))
)
df
df |> pool_draws(by = a)
df |> group_by(a) |> pool_draws()
df |> pool_draws()
df_big <- tibble(
a = c(1, 1, 2, 2, 1, 1, 2, 2),
b = c(1, 1, 1, 1, 2, 2, 2, 2),
x = rvec(list(1:2, 3:4, 5:6, 7:8,
9:10, 11:12, 13:14, 15:16)),
y = rvec(list(1:3, 4:6, 7:9, 10:12,
13:15, 16:18, 19:21, 22:24))
)
df_big |> pool_draws(by = c(a, b))
df_big |> group_by(a, b) |> pool_draws()
df_big |> pool_draws(by = a)
Run the code above in your browser using DataLab