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

Can we relax the requirement for inputs data frames to have at least one row? #2142

Open
ddsjoberg opened this issue Feb 14, 2025 · 2 comments
Milestone

Comments

@ddsjoberg
Copy link
Owner

I think with the new ARD framework, we may be able to get away with removing the requirement.

See note here: #2006

@ddsjoberg
Copy link
Owner Author

I did a small test where I commented out the check that the data frame passed to tbl_summary() has at least one row, and this is the table generated. I think we can fairly easy relax this requirement in many of the functions.

devtools::load_all(path = "/Users/sjobergd/Documents/GitHub/gtsummary")
#> ℹ Loading gtsummary
tbl_summary(trial[0,], include = grade) |> 
  as_kable()
Characteristic N = 0
Grade
I 0 (NA%)
II 0 (NA%)
III 0 (NA%)

Created on 2025-02-16 with reprex v2.1.1

@ddsjoberg ddsjoberg added this to the v2.2.0 milestone Feb 18, 2025
@Melkiades
Copy link
Collaborator

Many users often want to have a null report when the data has 0 rows. In {chevron} there is an example of that. In general, I would allow something like the above example (i.e. keeping the expected structure with empty values). I would rely on the users to call the null report if they want. Wdyt?

We need to test the trial[0,] case also in sorting and other post-processing functions that may break if there are no rows in the data (if the structure is preserved as in the above, I think it should be quite solid, but I would test it)

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

No branches or pull requests

2 participants