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

Render large tables #158

Merged
merged 23 commits into from
Feb 11, 2025
Merged

Render large tables #158

merged 23 commits into from
Feb 11, 2025

Conversation

sbreitbart-NOAA
Copy link
Collaborator

@sbreitbart-NOAA sbreitbart-NOAA commented Jan 28, 2025

What is the feature?

How have you implemented the solution?

  • Quantifying each table's width in create_tables_doc, then customizing the appropriate chunk in the 08_tables.qmd file so that tables wider than 5" are placed in a landscape-orientation page. Tables between 5-12" wide are forced to shrink in width to 7.5" (this shrinks the text to fit). Tables > 12" wide are split into multiple tables, saved as a new rda, and placed in individual chunks in the 08_tables.qmd doc.

Does the PR impact any other area of the project, maybe another repo?

  • No

Copy link
Contributor

github-actions bot commented Jan 28, 2025

Instructions for code reviewer

Hello reviewer, thanks for taking the time to review this PR!

  • Please use this checklist during your review, checking off items that you have verified are complete!
  • For PRs that don't make changes to code (e.g., changes to README.md or Github actions workflows), feel free to skip over items on the checklist that are not relevant. Remember it is still important to do a thorough review.
  • Then, comment on the pull request with your review indicating where you have questions or changes need to be made before merging.
  • Remember to review every line of code you’ve been asked to review, look at the context, make sure you’re improving code health, and compliment developers on good things that they do.
  • PR reviews are a great way to learn, so feel free to share your tips and tricks. However, for optional changes (i.e., not required for merging), please include nit: (for nitpicking) before making the suggestion. For example, nit: I prefer using a data.frame() instead of a matrix because...
  • Engage with the developer when they respond to comments and check off additional boxes as they become complete so the PR can be merged in when all the tasks are fulfilled. Make it clear when this has been reached by commenting on the PR with something like This PR is now ready to be merged, no changes needed.

Checklist

  • The PR is requested to be merged into the appropriate branch (typically main)
  • The code is well-designed.
  • The functionality is good for the users of the code.
  • Any User Interface changes are sensible and look good.
  • The code isn’t more complex than it needs to be.
  • Code coverage remains high, indicating the new code is tested.
  • The developer used clear names for everything.
  • Comments are clear and useful, and mostly explain why instead of what.
  • Code is appropriately documented (doxygen and roxygen).

@sbreitbart-NOAA sbreitbart-NOAA linked an issue Jan 28, 2025 that may be closed by this pull request
Copy link
Collaborator

@Schiano-NOAA Schiano-NOAA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I have not tested but looks like in practice it should just check if the table needs to be rotated or not

@Schiano-NOAA
Copy link
Collaborator

Next thing to think about is how this could be applied for custom tables? or do we just state a recommended practice to follow?

@sbreitbart-NOAA
Copy link
Collaborator Author

Looks good. I have not tested but looks like in practice it should just check if the table needs to be rotated or not

Thanks! What I hope is one of the last components of this PR, which I'm working on now, is designing a way to accommodate tables that need landscape orientation but are too wide to be shrunken with the existing workflow (e.g., red snapper, which has a 60" wide indices table without shrinking, and with shrinking, has text that is too small to read).

@sbreitbart-NOAA
Copy link
Collaborator Author

Next thing to think about is how this could be applied for custom tables? or do we just state a recommended practice to follow?

Great point. I'll write up an explanation for our workflow and explain how the user can do it manually for custom tables in the FAQs and manual.

… to require changing page orientation from portrait to landscape. Alter the Tables qmd to allow orientation changes for each table, if necessary.
…date documentation and usage in create_tables_doc()
…multiple smaller tables, but still a bug in render_lg_table (producing "Error" as part of output when testing)
…ccessfully rendering extra-wide table with new solution, but need to check if this will work in other circumstances
…p: apply to other tables, and simplify/clarify the new functions
…e tables will only reference the last table in the chunk, not the first. So next step: make a chunk for each table.

Also removed now irrelevant function: ID_split_tbls
@sbreitbart-NOAA sbreitbart-NOAA marked this pull request as ready for review February 6, 2025 22:26
Copy link
Collaborator

@Schiano-NOAA Schiano-NOAA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reran the create_tables_doc function from a previous example and it worked...however, it repeated the table caption over and over in the list of tables in the beginning of the doc and broke it up incorrectly in the document itself (I think). Guess we will need to chat about this next week. I can retest on monday with a fresh mind just in case :)

@sbreitbart-NOAA
Copy link
Collaborator Author

I reran the create_tables_doc function from a previous example and it worked...however, it repeated the table caption over and over in the list of tables in the beginning of the doc and broke it up incorrectly in the document itself (I think). Guess we will need to chat about this next week. I can retest on monday with a fresh mind just in case :)

Thanks for testing. Can you please explain how it's breaking the tables up incorrectly? And what would you prefer the table captions look like?

@Schiano-NOAA
Copy link
Collaborator

I reran the create_tables_doc function from a previous example and it worked...however, it repeated the table caption over and over in the list of tables in the beginning of the doc and broke it up incorrectly in the document itself (I think). Guess we will need to chat about this next week. I can retest on monday with a fresh mind just in case :)

Thanks for testing. Can you please explain how it's breaking the tables up incorrectly? And what would you prefer the table captions look like?

image

@Schiano-NOAA
Copy link
Collaborator

@sbreitbart-NOAA I think the tables are broken up fine but I wonder if it's possible to add into the caption the fleets that are included in the separated table

…in parentheses after caption (example: <indices caption> (Fleet 6, Fleet 7))
@sbreitbart-NOAA
Copy link
Collaborator Author

@Schiano-NOAA I've updated the workflow so that when a table is split, the header values for each table are added in parentheses to the end of the table caption, like this:

image

Is this change sufficient to approve the PR? Or should I make more changes to the workflow?

@Schiano-NOAA
Copy link
Collaborator

@Schiano-NOAA I've updated the workflow so that when a table is split, the header values for each table are added in parentheses to the end of the table caption, like this:

image

Is this change sufficient to approve the PR? Or should I make more changes to the workflow?

This should be good. Let me do a quick test

@sbreitbart-NOAA sbreitbart-NOAA merged commit 6b97ddc into dev Feb 11, 2025
@sbreitbart-NOAA sbreitbart-NOAA deleted the render-lg-tbls branch February 11, 2025 21: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.

Fix render with large tables
2 participants