Note: For GitHub Copilot-specific instructions, see
.github/copilot-instructions.md.
tibble is an R package that provides a modern reimagining of the data.frame.
It offers the tbl_df class with stricter checking and better formatting than traditional data frames.
Tibbles are lazy and surly: they do less (don't change variable names or types, don't do partial matching) and complain more (when a variable does not exist), helping you confront problems earlier and write cleaner code.
- Language: R with a few C functions
- Testing: testthat framework
- Documentation: roxygen2 with Markdown syntax
- Code Formatting: air (R formatting tool)
- Build System: R CMD, devtools
# Install all development dependencies
pak::pak()- When run on GitHub Actions, assume that R, the package in its current state and all dependencies are installed.
- Only install new packages when needed for implementing new features or tests.
- Run
devtools::check()to execute all checks as a final step.
- Load package for development:
pkgload::load_all() - Run tests:
testthat::test_local(reporter = "check") - Run tests for a single file
test-foo.R:testthat::test_local(filter = "foo", reporter = "check") - Build package:
devtools::build() - Check package:
devtools::check() - Update
.Rddocumentation:devtools::document() - Format code:
air format .
- PR titles should be descriptive and follow conventional commit style when appropriate
- Use backticks for code references such as
function_call() - PRs are generally squashed, a clean history within a PR is not necessary
- Before resuming work on a PR, always merge the current base branch (typically
main) - Do not edit
NEWS.mddirectly - it is managed by maintainers
- Prefer expressive code over comments where possible
- Add comments to utility functions that cannot be made immediately obvious
- Focus comments on explaining the "why" and "how", the "what" should be clear from the code itself
- Use line breaks after each sentence
- Follow the tidyverse style guide and the tidyverse design guide
- Use
snake_casefor new functions and all arguments - Use explicit package prefixes (e.g.,
withr::local_options()) for clarity - Maintain consistent indentation (2 spaces) and spacing patterns
- Use meaningful variable names that reflect context
- Run
styler::style_pkg()before committing changes to ensure consistent formatting - Do not restyle code that has nothing to do with your changes
- Never change deprecated functions
- Use roxygen2 with Markdown syntax for all function documentation
- Use explicit
@descriptionand@detailssections when needed - Keep each sentence on its own line in roxygen2 comments for better readability
- Document all arguments and return values
- Always run
devtools::document()after updating documentation
All new functions must include:
- Examples
- Tests
- Proper documentation, including arguments and return values
- All arguments in
snake_case, with documentation and suitable defaults - An ellipsis guarded with
rlang::check_dots_empty()or similar separating mandatory and optional arguments when appropriate - Argument validation using appropriate checking functions
- Test files should align with source files
R/name.R→tests/testthat/test-name.R
Do not commit: *.o, *.so, *.dll files in src/, and tests/testthat/testthat-problems.rds.
These are build artifacts that are regenerated automatically.
- Add test cases for all new functionality
- Test file naming should mirror source file naming
- Implement structured tests with clear expectations
- Run tests frequently during development and at the end:
testthat::test_local(reporter = "check") - Run
devtools::check()as a final step to ensure all checks pass - Use
expect_snapshot()for testing printed output and error messages