extendr-bindings

Solid

extendr conventions for exposing a Rust core to R: extendr macros and module registration, Robj type mapping, NA handling, rextendr builds, R package scaffolding, and CRAN compliance. Load when generating or reviewing extendr R bindings for a Rust library.

Data & Documents 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%
53
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

- Use `extendr` crate for Rust-R interop. `#[extendr]` macro on functions, `extendr_module!` for registration. - Type mapping: `Robj` for generic R objects, `Doubles`, `Integers`, `Strings`, `List` for typed access. - Return `Result<T, extendr_api::Error>` for R error propagation. Use `.into()` for Rust-to-R conversion. - NA handling: use `Rfloat::na()`, `Rint::na()` for missing values. Check with `.is_na()` before operations. - Build with `rextendr::document()` in R for development, `cargo build --release` for production. - Package integration: use `usethis::use_extendr()` for scaffolding. Maintain `src/rust/` in R package. - Test R-side with `testthat`, Rust-side with standard `#[test]`. Use `rextendr::test()` for integration. - CRAN compliance: `R CMD check --as-cran` must pass. No compiler warnings. Vendor Rust dependencies. - Keep R wrapper functions thin — heavy computation in Rust, R provides user-facing API with roxygen2 docs. - Anti-patterns: ignoring NA values, allocating R objects in Rust threads, panics in `#[extendr]` functions.

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