Skip to content

Latest commit

 

History

History
79 lines (67 loc) · 3.24 KB

File metadata and controls

79 lines (67 loc) · 3.24 KB

Project Context for r2rtf

Overview

This is an R package for generating RTF (Rich Text Format) tables, figures, and listings. As a senior data scientist maintaining this package, I should be familiar with RTF syntax and R package development best practices.

Key Information

  • Package Purpose: Generate RTF tables, figures, and listings programmatically in R
  • Domain: Clinical trial reporting and data visualization
  • RTF Expertise: Understanding of RTF syntax and specification is essential
  • R Version: 4.5.1 on macOS (aarch64-apple-darwin24.4.0)

Development Guidelines

  • Follow R package development best practices
  • Maintain backward compatibility when possible
  • Ensure RTF output conforms to specification
  • Test thoroughly with various table/figure configurations
  • Always run tests before committing changes

Development Workflow Commands (using devtools)

  • Load package for development: devtools::load_all()
  • Run all tests: devtools::test()
  • Run specific tests: devtools::test(filter = "rtf_title")
  • Build package: devtools::build()
  • Check package: devtools::check()
  • Generate/update documentation: devtools::document() or roxygen2::roxygenise()
  • Install package locally: devtools::install()
  • Build pkgdown site: pkgdown::build_site() or devtools::build_site()
  • Build reference only: pkgdown::build_reference()
  • Build articles only: pkgdown::build_articles()

System Dependencies (macOS with Homebrew)

Required system libraries for development:

  • libgit2 - for gert package
  • harfbuzz, fribidi - for textshaping package
  • freetype, libpng, libtiff, libjpeg-turbo - for ragg package
  • pkg-config - for package configuration
  • pandoc - for building documentation and vignettes

Install with: brew install libgit2 harfbuzz fribidi freetype libpng libtiff libjpeg-turbo pkg-config pandoc

Package Installation

For better dependency management, use pak:

# Install pak if not available
install.packages("pak", repos = "https://r-lib.github.io/p/pak/stable/")

# Install development tools
pak::pkg_install(c("devtools", "tidyverse", "testthat", "roxygen2", "pkgdown", "emmeans"))

Key Functions Being Maintained

  • rtf_title() - Add title attributes to tables
  • rtf_colheader() - Add column header attributes to tables
  • rtf_subline() - Add subline attributes to tables
  • rtf_body() - Format table body
  • rtf_footnote() - Add footnotes to tables
  • rtf_source() - Add source information to tables
  • rtf_page() - Set page attributes

Recent Changes

  • Issue #235: Added text_hyphenation parameter to rtf_title(), rtf_colheader(), and rtf_subline() functions
    • Default value is TRUE for backward compatibility
    • Allows users to control text hyphenation in RTF output
    • Branch: feature/issue-235-text-hyphenation

Important Files

  • DESCRIPTION: Package metadata
  • NAMESPACE: Exported functions
  • R/: Source code
  • tests/testthat/: Unit tests
  • man/: Documentation (auto-generated by roxygen2)
  • vignettes/: Package vignettes
  • inst/: Additional package files

Testing Approach

  • Unit tests using testthat framework
  • Test files named test-independent-testing-*.R
  • Snapshot tests for complex output validation
  • Always verify changes don't break existing functionality