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

Key column entry was empty for the first entry on a new page #155

Closed
shajoezhu opened this issue Sep 18, 2023 · 2 comments · Fixed by #162
Closed

Key column entry was empty for the first entry on a new page #155

shajoezhu opened this issue Sep 18, 2023 · 2 comments · Fixed by #162
Assignees
Labels
bug Something isn't working priority sme

Comments

@shajoezhu
Copy link
Collaborator

shajoezhu commented Sep 18, 2023

Example

library(rlistings)
dat <- ex_adae

lsting <- as_listing(dat[1:25, c(1:6, 40)],
                     key_cols = c("USUBJID", "AESOC"),
                     main_title = "Example Title for Listing",
                     subtitles = "This is the subtitle for this Adverse Events Table",
                     main_footer = "Main footer for the listing",
                     prov_footer = c(
                         "You can even add a subfooter", "Second element is place on a new line",
                         "Third string"
                     )
)
cat(export_as_txt(lsting, file = NULL, paginate =T, lpp = 33, cpp = 550))

output

Example Title for Listing
This is the subtitle for this Adverse Events Table

————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
Unique Subject Identifier   Primary System Organ Class   Study Identifier   Subject Identifier for the Study   Study Site Identifier   Age   Sex
————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
  AB12345-BRA-1-id-134                 cl A                  AB12345                     id-134                        BRA-1           47     M 
                                                             AB12345                     id-134                        BRA-1           47     M 
                                       cl B                  AB12345                     id-134                        BRA-1           47     M 
                                       cl D                  AB12345                     id-134                        BRA-1           47     M 
  AB12345-BRA-1-id-141                 cl A                  AB12345                     id-141                        BRA-1           35     F 
                                                             AB12345                     id-141                        BRA-1           35     F 
                                                             AB12345                     id-141                        BRA-1           35     F 
                                       cl B                  AB12345                     id-141                        BRA-1           35     F 
                                       cl D                  AB12345                     id-141                        BRA-1           35     F 
                                                             AB12345                     id-141                        BRA-1           35     F 
  AB12345-BRA-1-id-236                 cl B                  AB12345                     id-236                        BRA-1           32     M 
                                                             AB12345                     id-236                        BRA-1           32     M 
                                                             AB12345                     id-236                        BRA-1           32     M 
  AB12345-BRA-1-id-265                 cl C                  AB12345                     id-265                        BRA-1           25     M 
                                                             AB12345                     id-265                        BRA-1           25     M 
                                       cl D                  AB12345                     id-265                        BRA-1           25     M 
                                                             AB12345                     id-265                        BRA-1           25     M 
   AB12345-BRA-1-id-42                 cl A                  AB12345                     id-42                         BRA-1           36     M 
                                                             AB12345                     id-42                         BRA-1           36     M 
                                                             AB12345                     id-42                         BRA-1           36     M 
————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

Main footer for the listing

You can even add a subfooter
Second element is place on a new line
Third string
\s\nExample Title for Listing
This is the subtitle for this Adverse Events Table

————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
Unique Subject Identifier   Primary System Organ Class   Study Identifier   Subject Identifier for the Study   Study Site Identifier   Age   Sex
————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
                                       cl B                  AB12345                     id-42                         BRA-1           36     M 
                                                             AB12345                     id-42                         BRA-1           36     M 
                                       cl C                  AB12345                     id-42                         BRA-1           36     M 
                                                             AB12345                     id-42                         BRA-1           36     M 
                                       cl D                  AB12345                     id-42                         BRA-1           36     M 
————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

Main footer for the listing

You can even add a subfooter
Second element is place on a new line
Third string

One should expect to have, "AB12345-BRA-1-id-42" to appear on the second page first entry as well

Example Title for Listing
This is the subtitle for this Adverse Events Table

————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
Unique Subject Identifier   Primary System Organ Class   Study Identifier   Subject Identifier for the Study   Study Site Identifier   Age   Sex
————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
  AB12345-BRA-1-id-134                 cl A                  AB12345                     id-134                        BRA-1           47     M 
                                                             AB12345                     id-134                        BRA-1           47     M 
                                       cl B                  AB12345                     id-134                        BRA-1           47     M 
                                       cl D                  AB12345                     id-134                        BRA-1           47     M 
  AB12345-BRA-1-id-141                 cl A                  AB12345                     id-141                        BRA-1           35     F 
                                                             AB12345                     id-141                        BRA-1           35     F 
                                                             AB12345                     id-141                        BRA-1           35     F 
                                       cl B                  AB12345                     id-141                        BRA-1           35     F 
                                       cl D                  AB12345                     id-141                        BRA-1           35     F 
                                                             AB12345                     id-141                        BRA-1           35     F 
  AB12345-BRA-1-id-236                 cl B                  AB12345                     id-236                        BRA-1           32     M 
                                                             AB12345                     id-236                        BRA-1           32     M 
                                                             AB12345                     id-236                        BRA-1           32     M 
  AB12345-BRA-1-id-265                 cl C                  AB12345                     id-265                        BRA-1           25     M 
                                                             AB12345                     id-265                        BRA-1           25     M 
                                       cl D                  AB12345                     id-265                        BRA-1           25     M 
                                                             AB12345                     id-265                        BRA-1           25     M 
   AB12345-BRA-1-id-42                 cl A                  AB12345                     id-42                         BRA-1           36     M 
                                                             AB12345                     id-42                         BRA-1           36     M 
                                                             AB12345                     id-42                         BRA-1           36     M 
————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

Main footer for the listing

You can even add a subfooter
Second element is place on a new line
Third string
\s\nExample Title for Listing
This is the subtitle for this Adverse Events Table

————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
Unique Subject Identifier   Primary System Organ Class   Study Identifier   Subject Identifier for the Study   Study Site Identifier   Age   Sex
————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
  AB12345-BRA-1-id-42                  cl B                  AB12345                     id-42                         BRA-1           36     M 
                                                             AB12345                     id-42                         BRA-1           36     M 
                                       cl C                  AB12345                     id-42                         BRA-1           36     M 
                                                             AB12345                     id-42                         BRA-1           36     M 
                                       cl D                  AB12345                     id-42                         BRA-1           36     M 
————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

Main footer for the listing

You can even add a subfooter
Second element is place on a new line
Third string
@shajoezhu shajoezhu added bug Something isn't working sme priority labels Sep 18, 2023
@anajens anajens self-assigned this Sep 20, 2023
@anajens
Copy link
Contributor

anajens commented Sep 21, 2023

Still looking into this but a workaround could be to use paginate_listing instead of export_as_txt:

> paginate_listing(lsting, lpp = 33, cpp = 550)
[[1]]
Example Title for Listing
This is the subtitle for this Adverse Events Table

————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
Unique Subject Identifier   Primary System Organ Class   Study Identifier   Subject Identifier for the Study   Study Site Identifier   Age   Sex
————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
  AB12345-BRA-1-id-134                 cl A                  AB12345                     id-134                        BRA-1           47     M 
                                                             AB12345                     id-134                        BRA-1           47     M 
                                       cl B                  AB12345                     id-134                        BRA-1           47     M 
                                       cl D                  AB12345                     id-134                        BRA-1           47     M 
  AB12345-BRA-1-id-141                 cl A                  AB12345                     id-141                        BRA-1           35     F 
                                                             AB12345                     id-141                        BRA-1           35     F 
                                                             AB12345                     id-141                        BRA-1           35     F 
                                       cl B                  AB12345                     id-141                        BRA-1           35     F 
                                       cl D                  AB12345                     id-141                        BRA-1           35     F 
                                                             AB12345                     id-141                        BRA-1           35     F 
  AB12345-BRA-1-id-236                 cl B                  AB12345                     id-236                        BRA-1           32     M 
                                                             AB12345                     id-236                        BRA-1           32     M 
                                                             AB12345                     id-236                        BRA-1           32     M 
  AB12345-BRA-1-id-265                 cl C                  AB12345                     id-265                        BRA-1           25     M 
                                                             AB12345                     id-265                        BRA-1           25     M 
                                       cl D                  AB12345                     id-265                        BRA-1           25     M 
                                                             AB12345                     id-265                        BRA-1           25     M 
   AB12345-BRA-1-id-42                 cl A                  AB12345                     id-42                         BRA-1           36     M 
                                                             AB12345                     id-42                         BRA-1           36     M 
                                                             AB12345                     id-42                         BRA-1           36     M 
————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

Main footer for the listing

You can even add a subfooter
Second element is place on a new line
Third string

[[2]]
Example Title for Listing
This is the subtitle for this Adverse Events Table

————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
Unique Subject Identifier   Primary System Organ Class   Study Identifier   Subject Identifier for the Study   Study Site Identifier   Age   Sex
————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
   AB12345-BRA-1-id-42                 cl B                  AB12345                     id-42                         BRA-1           36     M 
                                                             AB12345                     id-42                         BRA-1           36     M 
                                       cl C                  AB12345                     id-42                         BRA-1           36     M 
                                                             AB12345                     id-42                         BRA-1           36     M 
                                       cl D                  AB12345                     id-42                         BRA-1           36     M 
————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

Main footer for the listing

You can even add a subfooter
Second element is place on a new line
Third string

@shajoezhu
Copy link
Collaborator Author

Thanks Jana! Yes, definitely an oversight we had when migrating the export_as_txt function into formatters.

Melkiades added a commit that referenced this issue Oct 10, 2023
Closes #155. 

Depends on insightsengineering/formatters#206

---------

Co-authored-by: Melkiades <davide.garolini@roche.com>
Melkiades added a commit to insightsengineering/formatters that referenced this issue Jan 19, 2024
…246)

Fixes the following issues

- [x] #243
- [x] #232
- [x] insightsengineering/rlistings#183
- [x] True fix for
insightsengineering/rlistings#155
- [x] insightsengineering/scda.test#99

To merge with insightsengineering/rlistings#192
(tests and misc) and
insightsengineering/rtables#813 (tests and
removed titles/footers newline handling)

---------

Signed-off-by: Davide Garolini <dgarolini@gmail.com>
Co-authored-by: 27856297+dependabot-preview[bot]@users.noreply.github.com <27856297+dependabot-preview[bot]@users.noreply.github.com>
Melkiades added a commit that referenced this issue Jan 19, 2024
Fixes #191 and #183. This should be the real fix for
#155
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority sme
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants