Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Begin to address #11 #18

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Begin to address #11 #18

wants to merge 4 commits into from

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.

1 participant