Skip to content

Conversation

@mstackhouse
Copy link
Contributor

This starts to address #11 by actually using set_header_n() to pull utilize the provided data frame for denominators.

Example code:

adsl <- haven::read_xpt("https://github.com/phuse-org/TestDataFactory/raw/main/Updated/TDF_ADaM/adsl.xpt")
adae <- haven::read_xpt("https://github.com/phuse-org/TestDataFactory/raw/main/Updated/TDF_ADaM/adae.xpt")

hd_n <- tibble::tribble(
  ~TRT01P, ~n,
  "Placebo", 96,
  "Xanomeline High Dose", 94,
  "Xanomeline Low Dose", 94
)

## Test for normal functionality with ADSL
t <- ardis(adsl, TRT01P, cols=SEX) %>%
  set_header_n(hd_n) %>%
  add_layer(
    group_count(RACE) %>% 
      set_distinct_by(USUBJID) %>% 
      set_summaries(
        vars(distinct_n, distinct_pct, distinct_total)
      )
  ) 

t %>% 
  build()

# Adverse events
t <- ardis(adae, TRTA) %>% 
  set_header_n(hd_n, TRT01P) %>%
  add_layer(
    group_count(vars(AEBODSYS, AEDECOD)) %>% 
      set_distinct_by(USUBJID) %>% 
      set_summaries(vars(distinct_n, distinct_pct, distinct_total))
  )

t %>% 
  build()

@mstackhouse mstackhouse requested a review from statasaurus May 22, 2023 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants