r-conventions

Solid

R code conventions covering R 4.1+, tidyverse/base style, styler/lintr, roxygen2, testthat, error handling, input validation, C/C++/Rust interop, and CRAN compliance. Load when writing or reviewing R code.

Code & Development 137 stars 13 forks Updated today MIT

Install

View on GitHub

Quality Score: 84/100

Stars 20%
71
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
51
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

- R 4.1+, a consistent style guide (e.g., tidyverse), a formatter (e.g., styler) and a linter (e.g., lintr). - Base R pipe `|>` over magrittr `%>%`, prefer base R when tidyverse not needed. - Package dev: `devtools`/`usethis`/`roxygen2`, `testthat` (80%+ via a coverage tool, e.g., covr). - Documentation: roxygen2 for inline docs and NAMESPACE management. `@examples` on all exports. - Vignettes with `knitr`/`rmarkdown` for long-form documentation and tutorials. - Error handling: `tryCatch()`/`withCallingHandlers()`, `cli::cli_abort()` for user-facing errors. - Input validation: `checkmate` or `rlang::arg_match()` for function parameter validation. - Security: a dependency vulnerability scanner (e.g., oysteR). - C/C++: `Rcpp` or `.Call()`, PROTECT/UNPROTECT all R objects. Rust: `extendr`/`rextendr`. - CRAN: `R CMD check --as-cran` zero warnings/notes, maintain DESCRIPTION with proper versioning. - Anti-patterns: `eval(parse(text=))` with user input, mixing Rcpp and raw C API, `T`/`F` instead of `TRUE`/`FALSE`.

Details

Author
Goldziher
Repository
Goldziher/ai-rulez
Created
1 years ago
Last Updated
today
Language
Go
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category