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

keep_titles, etc not respected when selecting zero rows via [ #870

Open
gmbecker opened this issue May 21, 2024 · 6 comments
Open

keep_titles, etc not respected when selecting zero rows via [ #870

gmbecker opened this issue May 21, 2024 · 6 comments

Comments

@gmbecker
Copy link
Collaborator

keep_titles works (and, I imagine, the other rtables specific args to [) if we select at least one row, but not if we select zero rows:

lyt <- basic_table(title = "hiya I'm a title!") %>%
    split_rows_by("ARM") %>%
    analyze("AGE")

tbl <- build_table(lyt, ex_adsl)
> main_title(tbl[1, , keep_titles = TRUE])
[1] "hiya I'm a title!"
> main_title(tbl[integer(), , keep_titles = TRUE])
[1] ""
@shajoezhu shajoezhu added the sme label Nov 11, 2024
@gmbecker
Copy link
Collaborator Author

gmbecker commented Feb 4, 2025

@shajoezhu any movement about this

@shajoezhu
Copy link
Collaborator

ah, sorry, missed this thread. would the expected results be "hiya I'm a title!"? or should this throw an error, as we could treat tbl[integer(), , keep_titles = TRUE] as an empty table? null table?

@BFalquet @Melkiades @edelarua any thoughts?

I think we should have "hiya I'm a title!", as if we prune or trim a table, and as the results, it has zero rows, title and footnotes, these should return values. right? if this is the case, this is a bug, and we can take care of this. Thanks

@Melkiades
Copy link
Contributor

I would keep all decorators, even if it is a 0-rows table

@edelarua
Copy link
Contributor

I would keep all decorators as well.

@gmbecker
Copy link
Collaborator Author

The code should do whatever the arguments say (e.g. keep_titles = TRUE vs FALSE). There are times when the title, top-left, etc is no longer appropriate when subsetting rows, and there are times when it is.

My point is that I told it to keep titles and it didn't, which is a bug.

@shajoezhu
Copy link
Collaborator

all agreed. its a bug

@Melkiades Melkiades added the bug label Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants