-
-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Milestone
Description
What's the feature?
Right now if I have two ARDs one with a list column and one not I need to do some manual work to bind them; both bind_rows and bind_ard will error in this case. See this artificial example:
library(cards)
ard_auto <- ADSL |>
dplyr::group_by(ARM) |>
ard_summary(
variables = "AGE",
statistic =
~ list(conf.int = \(x) t.test(x)[["conf.int"]] |>
as.list() |>
setNames(c("conf.low", "conf.high")))
)
ard_custom <- ADSL %>%
summarise(
stat = median(AGE)
) %>% mutate(
variable = "AGE",
stat_label = "Median",
stat_name = stat_label
) %>% as_card()
cards::bind_ard(ard_auto, ard_custom)
ard_custom_list <- ard_custom %>%
mutate(
stat = list(stat)
)
cards::bind_ard(ard_auto, ard_custom_list)
I think that either
as_card()should either be more opionated (reject columns with wrong format) or transform columns- bind_ard() can handle if it sees a list column and a numeric column
To some extent I feel like bind_rows should really be able to handle this, but seeing as this is likely to come up I think a handler.
My personal preference is for as_card() to be a bit more demanding to help me understand whether the tibble I have made is actually close to being a fit for cards.
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
No status