# A simple example
lst <- lapply(1:5, function(x) {
list(
"A" = data.frame("first" = x, "second" = rnorm(x)),
"B" = data.frame("info" = 1, "other" = 3)
)
})
braid_rows(lst)
# An example with an additional layer and jagged innermost info
lapply(c(28, 186, 35), function(len) {
lapply(c("a", "b"), function(x) {
res <- list(
"descriptive" = data.frame(
risk = len,
event = x,
var = 1,
other = 2
),
"results" = data.frame(
risk = len,
event = x,
important = 4:7,
new = 3:6
)
)
if (len < 30) {
res <- c(res, list("additional" = data.frame(helps = "extra data")))
}
return(res)
}) |> braid_rows()
}) |> braid_rows()
Run the code above in your browser using DataLab