Skip to content

Feature Request: Allow bind_ard to account for context. #519

@kieranjmartin

Description

@kieranjmartin

What's the feature?

Currently if you try binding two "identical" (same groups, variable and stat name) ards using bind_ard you get an error unless you use .update=TRUE and then you end up with just the first one.

But there are situations where I may want to bind ARD's which are "identical".

For example; two regressions with different covariates or even just two summaries with different filters. E.g.

library(cards)
library(dplyr)

ard <- ard_tabulate(ADSL, by = "ARM", variables = "AGEGR1")
ard_filter <- ADSL |> filter(SEX == "M") |> 
  ard_tabulate(by = "ARM", variables = "AGEGR1") |> 
  mutate(
    context = "Filtered on SEX == M"
  )

bind_ard(ard, ard_filter, .update = TRUE)

I could use the grouping level in this example, although this could be a pain and maybe even an abuse of the system in some cases (imagine I filter on 4 or more variables).

Imagine where I have a piece of code where I derive a bunch of identical ARDs for different subgroups. I could of course save them as different ARDs, but then imagine I am doing this for say 30 different outputs, I end up with 30*subgroups ards to go through!

In the ARS specification there is an additional column which covers the filter I am creating, but I think the simplest thing here might be to allow bind_ard to have a new argument like consider_context=FALSE where if set to TRUE it will consider two otherwise identical ARDs with different contexts to be considered distinct.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions