Contribution Guidelines
Source:CONTRIBUTING.md
Thank you for taking the time to contribute to BORG.
This document provides guidelines for contributing to BORG’s codebase and documentation. These guidelines are meant to help, not restrict. If in doubt, use your best judgment and feel free to propose improvements through an issue or pull request.
Code of Conduct
This project and everyone participating in it is governed by our Code of Conduct (CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code and maintain a respectful, inclusive environment.
Installation
This installation guide is focused on development. For regular installation, please see the README.
Setting up your R environment
BORG is an R package that uses C++ code via Rcpp.
-
Install required tools
- R (>= 4.0)
- Rtools (Windows) or Xcode Command Line Tools (macOS)
- Git
- An editor or IDE (RStudio, VS Code, etc.)
-
Install development dependencies
install.packages(c("devtools", "roxygen2", "testthat", "rmarkdown", "knitr", "pkgdown")) -
Load the development build
devtools::load_all()
Testing
BORG uses testthat for testing. All tests are located in tests/testthat/.
Run the full test suite:
devtools::test()Run a complete package check:
devtools::check()Run a subset of tests during development:
Guidelines: - Keep tests fast and reproducible. - Use set.seed() for random data. - Include edge cases and expected failures. - Prefer small examples to large datasets.
Documentation
Install dependencies
install.packages(c("rmarkdown", "knitr", "pkgdown"))Building the documentation
Build vignettes:
devtools::build_vignettes()Build the pkgdown site locally:
pkgdown::build_site()The generated site is saved in the docs/ directory. Open docs/index.html in your browser to view it.
Project organization
BORG/
├── .github/ <- Continuous integration workflows
├── .gitignore
├── .Rbuildignore
├── BORG.Rproj
├── DESCRIPTION <- Package metadata
├── NAMESPACE <- Function exports and imports
├── LICENSE
├── LICENSE.md
├── NEWS.md
├── README.md
├── _pkgdown.yml
├── R/ <- R source files
├── src/ <- C++ source files (Rcpp)
├── man/ <- Generated documentation
├── inst/ <- Installed files (e.g., CITATION)
├── vignettes/ <- Long-form documentation and usage examples
├── tests/
│ └── testthat/ <- Unit tests
├── docs/ <- pkgdown website (generated)
└── doc/ <- Built vignettes for local preview (ignored)
Contributing workflow
-
Create a feature branch
Make focused commits with clear messages.
-
Run tests and checks before committing:
Update documentation with
roxygen2andNEWS.md.Update vignettes/examples if user-facing behavior changes.
Open a pull request with a short description of your change.
Respond to review feedback constructively.
Style guidelines
R code
- Use descriptive names and consistent indentation.
- Prefer vectorized operations over loops.
- Validate inputs early with clear error messages.
- Document all exported functions with roxygen2.
Reporting bugs
When reporting an issue, please include: - A minimal reproducible example (reprex) - Output of sessionInfo() - Expected vs. actual results - Which BORG function was called and with what arguments - R and operating system version
By contributing to BORG, you agree that your code is released under the same license as the package.