Contributing to OECDscaleup
Source:CONTRIBUTING.md
Thanks for contributing. This package computes the OECD Scale Up project’s indicators, used by national statistical institutes across the OECD to compute internationally-comparable high-growth-firm statistics — correctness and faithfulness to the documented methodology matter more here than in most packages.
Before you start
- For anything beyond a small fix, open an issue first to discuss the change — especially anything touching indicator definitions (
build_accounts_indicators()), the classification rules incompute_persistence()/compute_predictors(), or the disclosure-control logic (dominance_share(),approx_median()). - If you’re changing behaviour rather than just refactoring, explain the change and add a
NEWS.mdentry.
Setup
renv::restore() # install the pinned dependency versions
devtools::load_all() # load the package for interactive development
devtools::test() # run the test suiteMaking a change
- Create a branch for your change.
- Make the change, adding or updating tests in
tests/testthat/— every exported function should have test coverage for its normal case, at least one edge case (missing/NA inputs are the most common source of subtle bugs in this codebase — seestata_num()/stata_replace()’s documentation for why), and, for anything touching Stata-derived semantics, a test that documents why the expected value is what it is (not just that it matches). - Run
devtools::document()if you added or changed any roxygen comments, and commit the regenerated files underman/andNAMESPACE. - Run
devtools::test()anddevtools::check()locally before opening a pull request — both also run in CI on every push and pull request. - Update
NEWS.mdwith a one-line summary of user-facing changes.
Code style
- Follow the tidyverse style already used throughout (
snake_case,dplyr-based data wrangling, roxygen2 with markdown enabled). - Prefer adding a well-named, tested helper in
R/utils-panel.Rover inlining a workaround for a Stata/R semantic gap —stata_num()andstata_replace()both started this way, and a third such gap is likely to recur elsewhere in the codebase. - Don’t add speculative configuration options, abstractions, or generality beyond what an actual, current requirement needs.