Contributing to msPCA
Source:CONTRIBUTING.md
Thank you for your interest in contributing to msPCA. This document covers everything you need to get the development environment running and submit high-quality changes.
Development setup
Prerequisites
- R ≥ 4.1 (tested on release and devel)
- A C++14-capable compiler (GCC ≥ 7, Clang ≥ 5, or MSVC 2017+)
- The following R packages:
install.packages(c("Rcpp", "RcppEigen", "devtools", "testthat", "covr"))Clone and install
# From the R console, inside the package directory:
devtools::install(dependencies = TRUE)Running tests
devtools::test()
# or equivalently:
testthat::test_local()All tests live in tests/testthat/. The test files are:
| File | What it covers |
|---|---|
test-mspca.R |
mspca() output structure, Sigma and X paths, real-data smoke tests |
test-tpm.R |
tpm() output structure, both input paths |
test-validators.R |
Error paths for invalid inputs (non-square, non-PSD, non-finite, …) |
test-s3methods.R |
print.mspca, summary.mspca, and helper functions |
Coverage report
covr::report() # opens an HTML coverage report in the browserThe project targets ≥ 90% line coverage.
Code style
R
- Follow tidyverse style for R code.
- Exported functions and helpers must have roxygen2 documentation blocks.
- All roxygen directives use Markdown (enabled via
Roxygen: list(markdown = TRUE)inDESCRIPTION). - Run
devtools::document()after any change to roxygen comments.
Documentation
Rebuild Rd files after changing roxygen comments:
devtools::document()Rebuild the pkgdown site (requires pkgdown):
pkgdown::build_site()The docs/ folder is committed to main and served as GitHub Pages — do not delete it.
Submitting changes
-
Fork the repository and create a branch from
main: Make your changes and add or update tests as appropriate.
Ensure
devtools::check()passes with no new errors, warnings, or notes (the CI matrix runsR CMD check --as-cranon Linux, macOS, and Windows).Push your branch and open a pull request against
main.Fill in the pull request description, referencing any related issues.