What problem does it solve?
This Skill helps data analysts and scientists ensure high-quality, testable, and maintainable R code for data analysis. It provides clear best practices, integrates modern testing and linting tools, and applies TRUST 5 principles, reducing errors and improving the reliability of your analytical workflows.
Core Features & Use Cases
- R 4.4+ Best Practices: Guides on writing clean, efficient, and idiomatic R code for various data tasks.
testthat 3.2 Integration: Supports Test-Driven Development (TDD) workflows for robust unit testing of R functions.
lintr 3.2 for Code Quality: Automatically checks your R code for style consistency and potential issues, ensuring adherence to coding standards.
- Use Case: When developing a new data analysis script, this skill guides you through writing unit tests with
testthat and linting your code with lintr to ensure reliability and adherence to coding standards, saving time on debugging and refactoring.
Quick Start
Provide a basic example of a testthat unit test for an R function that calculates the mean of a numeric vector.