Conversation
- Introduced `fp_txt_where` function for selector-based text styling in forest plots. - Added `inventors_vs_mello` dataset for demonstration purposes. - Enhanced documentation for `prFpFetchRowLabel` and `text_styling` functions. - Improved data generation logic in `make_forest_metadata_inventors_vs_mello`. - Added visual regression tests for column spanning and selector-based styling. - Implemented tests for label extraction and insertion functionalities. - Updated vignettes to include examples of new features and improved workflows.
- Introduced `fp_set_favors()` function to add left/right interpretation labels around the x-axis. - Updated `prFpGetGraphTicksAndClips` and `plot.forestplot_xaxis` to handle new favors indicators. - Added examples and documentation for `fp_set_favors()`. - Created tests for `fp_set_favors()` to validate functionality and argument handling. - Updated vignettes to demonstrate the use of favors indicators in forest plots.
There was a problem hiding this comment.
Pull request overview
This PR releases forestplot v3.2.0, expanding label handling and post-processing capabilities (spanning, selector-style styling, label extraction), improving grouped-data plumbing, and updating documentation/examples (including a new simulated dataset).
Changes:
- Added label helpers for spanning (
fp_span()), selector-based styling (fp_align_where(),fp_txt_where(),fp_span_where()), label extraction (fp_extract_labeltext(),fp_extract_labels()), and summary/favors helpers (fp_set_summary(),fp_set_favors()). - Extended label rendering to tolerate non-atomic objects (notably grid grobs) in
labeltext, and implemented span-aware label printing. - Updated vignettes, examples, tests, NEWS/versioning, and dataset documentation; added
inventors_vs_mellodata + docs and enabledLazyData.
Reviewed changes
Copilot reviewed 53 out of 55 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| vignettes/forestplot.Rmd | Adds extended examples demonstrating spanning, extraction, selector styling, and favors indicators. |
| tests/testthat/test-span.R | New unit tests for fp_span() and grob-in-labeltext support. |
| tests/testthat/test-selector-styling.R | New unit tests for selector-based styling helpers and fp_set_summary(). |
| tests/testthat/test-insert_row.R | Extends row/header manipulation tests to cover spanned headers and collisions. |
| tests/testthat/test-fp_add_favors.R | New tests for fp_set_favors() storage/validation/rendering. |
| tests/testthat/test-extract-labeltext.R | New tests for fp_extract_labeltext() / fp_extract_labels() behavior. |
| tests/forestplot2_vtests.R | Adds a visual regression exercise for column spanning; minor formatting changes. |
| tests/data_generator.R | Adds generator for the new inventors_vs_mello example dataset. |
| man/text_styling.Rd | Documents fp_span() in the text styling help page. |
| man/style_manipulation.Rd | Adds fp_set_favors() to related-function lists. |
| man/row_manipulation.Rd | Adds fp_set_favors() to related-function lists. |
| man/prFpFetchRowLabel.Rd | Documents that label cells may be grid grobs. |
| man/inventors_vs_mello.Rd | New Rd for the inventors_vs_mello dataset. |
| man/fp_txt_where.Rd | New Rd for selector-based text gp helper. |
| man/fp_span_where.Rd | New Rd for selector-based spanning helper. |
| man/fp_set_zebra_style.Rd | Adds fp_set_favors() to related-function lists. |
| man/fp_set_summary.Rd | New Rd for selector-based summary row helper. |
| man/fp_set_favors.Rd | New Rd for favors indicators helper. |
| man/fp_extract_labeltext.Rd | New Rd for extracting labeltext columns from data frames. |
| man/fp_extract_labels.Rd | New Rd for rebuilding labels from stored source data. |
| man/fp_decorate_graph.Rd | Adds fp_set_favors() to related-function lists. |
| man/fp_align_where.Rd | New Rd for selector-based alignment helper. |
| man/fp_add_lines.Rd | Adds fp_set_favors() to related-function lists. |
| man/fpShapesGp.Rd | Adds fp_set_favors() to related-function lists. |
| man/fpLegend.Rd | Adds fp_set_favors() to related-function lists. |
| man/fpDrawCI.Rd | Adds fp_set_favors() to related-function lists. |
| man/fpColors.Rd | Adds fp_set_favors() to related-function lists. |
| man/forestplot.Rd | Updates examples/docs (including spanning example) and notes grob label support. |
| man/dfHRQoL.Rd | Moves/expands dataset documentation to R/data-descriptions.R. |
| man/HRQoL.Rd | Moves/expands dataset documentation to R/data-descriptions.R. |
| inst/examples/fp_set_favors_example.R | Adds runnable example for fp_set_favors(). |
| inst/examples/forestplot_example.R | Updates examples and adds spanning demonstration. |
| data/inventors_vs_mello.rda | Adds the new example dataset binary. |
| README.md | Mentions new spanning and grob-in-labeltext capabilities. |
| R/text_styling.R | Implements fp_span() and selector-based styling helpers incl. fp_set_summary(). |
| R/private_prepLabelText.R | Adjusts label preparation to avoid is.na() on non-atomic/grob cells. |
| R/private_prGetLabelsList.R | Propagates span attributes and supports grob label cells. |
| R/private_plot.forestplot_xaxis.R | Adds rendering for favors indicators in/around x-axis area. |
| R/private.R | Updates label printing to support spanning across columns. |
| R/prFpGetGraphTicksAndClips.R | Threads graph_favors through axis object for plotting. |
| R/fp_insert_row.R | Refactors row insertion; adds span-aware header handling and collision checks. |
| R/fp_extract_labeltext.R | Adds fp_extract_labeltext() and fp_extract_labels() plus grouped extraction utilities. |
| R/fp_decorate_graph.R | Adds fp_set_favors() helper and related plotting adjustments. |
| R/forestplot.grouped_df.R | Refactors grouped-data handling and stores estimate column names for downstream helpers. |
| R/forestplot.default.R | Standardizes default colgap handling. |
| R/forestplot.data.frame.R | Stores source data + tidy estimate column names for downstream helpers. |
| R/forestplot.R | Updates roxygen docs to mention grob label support. |
| R/drawForestplotObject.R | Refactors plotting setup and adjusts axis layout for outside favors indicators. |
| R/data-descriptions.R | New consolidated dataset documentation (HRQoL/dfHRQoL/inventors_vs_mello). |
| R/data-HRQoL.R | Removes older dataset documentation source file. |
| NEWS.md | Adds 3.2.0 release notes. |
| NAMESPACE | Exports newly added helpers. |
| DESCRIPTION | Bumps version to 3.2.0 and enables LazyData. |
| CRAN-SUBMISSION | Adds CRAN submission metadata file. |
| .gitignore | Ignores Rplots.pdf. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| safeLoadPackage("dplyr") | ||
| safeLoadPackage("tidyr") | ||
|
|
||
| if (!is.data.frame(x)) { | ||
| stop("'x' must be a data.frame or grouped_df") | ||
| } | ||
|
|
||
| dots <- rlang::enquos(...) | ||
| if (length(dots) > 0 && !is.null(cols)) { | ||
| stop("Provide either tidyselect columns via '...' or explicit 'cols', not both") |
There was a problem hiding this comment.
fp_extract_labeltext() uses rlang::enquos(...) but never calls safeLoadPackage("rlang"). Because rlang is listed under Suggests, this function will error if the user doesn't have rlang installed.
Suggestion: add safeLoadPackage("rlang") near the top (alongside the existing dplyr/tidyr checks).
R/fp_insert_row.R
Outdated
| stop("Unkown label columns ", paste(lacking_match, collapse = ", "), | ||
| " not present among: ", paste(names(x$labels), collapse = ", ")) | ||
| stop( | ||
| "Unkown label columns ", paste(lacking_match, collapse = ", "), |
There was a problem hiding this comment.
Typo in error message: "Unkown" should be "Unknown".
| "Unkown label columns ", paste(lacking_match, collapse = ", "), | |
| "Unknown label columns ", paste(lacking_match, collapse = ", "), |
man/text_styling.Rd
Outdated
| \item{txt}{The text to styl} | ||
|
|
There was a problem hiding this comment.
Typo in docs: "The text to styl" should be "The text to style".
This pull request introduces version 3.2.0 of the
forestplotpackage, adding several new features, helpers, and improvements focused on label handling, selector-style post-processing, and data documentation. It also refactors internal code for clarity and extensibility, especially around grouped data and plotting logic.New features and helpers
fp_span(),fp_extract_labeltext(),fp_align_where(),fp_txt_where(),fp_span_where(),fp_set_summary(), andfp_set_favors(), enabling advanced label spanning, extraction, targeted styling, and summary/favors row setting forgforge_forestplotobjects. These helpers allow more flexible and expressive forest plot customization. [1] [2]labeltext, preventing coercion errors and allowing direct rendering of complex content in table cells.Data documentation and structure
HRQoL,dfHRQoL, andinventors_vs_mello) toR/data-descriptions.R, with detailed format, source, and usage examples. This clarifies the structure and intended use for users and developers. [1] [2]Selector-style and grouped data improvements
forestplot.grouped_df, introducingfpGetVaryingGroups()for robust group extraction and improved error handling. Also added logic to capture tidy column names for estimates in both grouped and ungrouped data, facilitating downstream processing and reproducibility. [1] [2] [3] [4] [5] [6]Plotting and internal code cleanup
drawForestplotObjectto consistently use named arguments and improved readability, especially for plotting, label, and legend preparation. Added logic to adjust axis layout height when favors text/arrows are positioned outside the plot. [1] [2] [3] [4] [5]colgaphandling inforestplot.defaultfor more predictable column spacing.Other updates
LazyDatafor efficient example dataset loading. [1] [2] [3]These changes collectively enhance the flexibility, usability, and robustness of the
forestplotpackage for both basic and advanced plotting scenarios.