This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
- Full package check:
Rscript -e "devtools::check()" - In R session:
- Re-load package:
devtools::load_all() - Update documentation:
devtools::document() - Run all tests:
devtools::test() - Run single test:
testthat::test_file("tests/testthat/test-filename.R") - Code coverage:
covr::package_coverage()
- Re-load package:
- In the terminal, wrap the commands above like this:
Rscript -e "devtools::load_all(); <COMMAND>"
- Function naming: Use snake_case with
tf_prefix for exported functions - Method implementation: Use
ClassName.methodpattern for S3 methods - Documentation: Use roxygen2 with markdown formatting (@param, @return)
- Imports: Declare dependencies in DESCRIPTION file; avoid tidyverse; avoid adding dependencies to additional packages.
- Error handling: Use cli::cli_abort() or cli::cli_warning() for errors and warnings, or use checkmate-assertions and the custom assertions from assertions.R
- Object creation: Follow vctrs framework for S3 classes
- Testing: Write unit tests with testthat v3 (expect_equal, expect_error)
- PRs: Make pull requests against the 'main' branch
Always reload the package with devtools::load_all() before testing changes.