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

bug fix: keep factor rows with completely missing values #165

Merged
merged 2 commits into from
Jul 12, 2024

Conversation

fb-elong
Copy link
Collaborator

@fb-elong fb-elong commented Jul 12, 2024

The factor with empty factor should have a row as output

meta <- meta_example() |>
  define_parameter(name = "sex", var = "SEX1", label = "Sex")
meta$data_population$SEX1 <- factor(meta$data_population$SEX, c("M", "F", "Other"))
collect_n_subject(meta, "apat", "sex")
                name     Placebo Xanomeline Low Dose Xanomeline High Dose        Total
1 Number of Subjects          86                  84                   84          254
2                Sex        <NA>                <NA>                 <NA>         <NA>
3 Subjects with Data          86                  84                   84          254
4                  M 33 ( 38.4%)         34 ( 40.5%)          44 ( 52.4%) 111 ( 43.7%)
5                  F 53 ( 61.6%)         50 ( 59.5%)          40 ( 47.6%) 143 ( 56.3%)
6              Other  0 (  0.0%)          0 (  0.0%)           0 (  0.0%)   0 (  0.0%)

Also tested in metalite.table1 that works as expected after the code change.

metalite.table1::metalite_table1(~ SEX1 | TRTA, data = meta$data_population)

image

@fb-elong fb-elong merged commit 8d91831 into main Jul 12, 2024
@nanxstats nanxstats deleted the bug-empty-factor branch July 12, 2024 19:05
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