This is the forestly R package, which creates interactive forest plots for clinical trial data analysis. The package is built on top of metalite and metalite.ae packages and uses reactable for interactive tables with Plotly.js for interactive visualizations.
- load project using
devtools::load_all() - Run tests using:
devtools::test() - Run specific test files using:
devtools::test(filter = "filename") - Before running tests, ensure required packages are installed (metalite, metalite.ae, reactable, reactR)
- Follow tidyverse style guide
- Use
|>pipe operator (R 4.1+) - Functions should handle both character vectors and factors robustly
ae_forestly(): Main function to create interactive forest plotsformat_ae_forestly(): Formats AE data and configures Plotly visualizationsformat_ae_listing(): Formats AE listing datasparkline_point_js(): Generates JavaScript/Plotly code for interactive sparkline plotspropercase(): Converts strings to proper case (handles factors)titlecase(): Converts strings to title case using tools::toTitleCase (handles factors)
- Run linting: Check for any linting issues in the IDE
- Run tests:
devtools::test()to ensure all tests pass - Check documentation:
devtools::document()if roxygen comments are updated
- Main branch:
main - Feature branches: Use descriptive names like
fix-factor-handlingoradd-new-feature - Always create pull requests for merging into main
# Load all functions for development
devtools::load_all()
# Run all tests
devtools::test()
# Check package
devtools::check()
# Build documentation
devtools::document()- metalite
- metalite.ae
- reactable
- reactR
- plotly (via JavaScript integration)
- brew (for template processing)
- tools (base R)
The package includes test data in data/:
- forestly_adae.rda
- forestly_adae_3grp.rda
- forestly_adsl.rda
- forestly_adsl_3grp.rda
- The
ae_listing.Rfile contains functions that handle factor inputs, which was a recent fix - Test files should use
devtools::load_all()or source the R files directly for testing - The package uses testthat for unit testing framework
- Interactive plots use Plotly.js via JavaScript templates in
inst/js/ - The y-axis ordering in
format_ae_forestly.Raffects the visual display in interactive plots - When debugging interactive plot issues, check both R code and JavaScript template files