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

value parameter in tbl_summary doesn't work on an empty category #780

Closed
JeremyPasco opened this issue Feb 11, 2021 · 1 comment · Fixed by #794
Closed

value parameter in tbl_summary doesn't work on an empty category #780

JeremyPasco opened this issue Feb 11, 2021 · 1 comment · Fixed by #794
Milestone

Comments

@JeremyPasco
Copy link

Expected behavior:

Setting the value parameter of tbl_summary on a category should display only this category, even if this category has a null count.

Actual behavior

On categorical variables, setting the value parameter on a non represented category does nothing.

Reprex

library(tidyverse)
library(gtsummary)

x <- trial %>% 
  transmute(
    trt = fct_expand(trt, 'Drug C')
  )

tbl_summary(x) # display all categories: OK
tbl_summary(x, value = trt ~ "Drug A") # display only Drug A: OK
tbl_summary(x, value = trt ~ "Drug C") # display all categories: wrong

Created on 2021-02-11 by the reprex package (v0.3.0)

By this third summary, I expected one row with : Drug C 0 (0%)

@ddsjoberg
Copy link
Owner

😱 thank you so much for the report!

@ddsjoberg ddsjoberg added this to the 1.4.0 milestone Feb 13, 2021
ddsjoberg added a commit that referenced this issue Feb 22, 2021
ddsjoberg added a commit that referenced this issue Mar 2, 2021
* in progress

* Update utils-tbl_summary.R

* first draft complete

* Update test-tbl_summary.R

* Update test-assign_dichotomous_value.R

* Update test-assign_summary_type.R

* Update test-assign_dichotomous_value.R

* updates

* Update DESCRIPTION

* added test for #780

* updates for svysummary

* Update utils-tbl_summary.R

* Update utils-tbl_summary.R

* Update utils-tbl_summary.R

* Increment version number

* Update WORDLIST

* added seed to examples to get same result each run

* doc update

* doc updates
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 a pull request may close this issue.

2 participants