Crates.io | typed-sexp |
lib.rs | typed-sexp |
version | 0.0.1 |
source | src |
created_at | 2024-09-16 02:16:45.071308 |
updated_at | 2024-09-16 02:16:45.071308 |
description | Rust library for working with R's SEXP type in a type-safe way. |
homepage | |
repository | |
max_upload_size | |
id | 1375952 |
size | 87,292 |
Type-safe manipulation of R's SEXP objects without bells and whistles.
R internal API is very confusing and not type-safe.
However many times I do not want to pull in huge proc macros just to write my R extension. The main reasons are:
This library is an attempt to provide a type-safe interface to R's SEXP objects without any user-exposed macros.
However it is not a goal to provide a high-level abstractions over R's API like Rcpp
or extendr
, the most I will do is type-safe indexing, attributes, calling functions, etc.
Users are expected to have a general understanding of R internals.
Here is a quick tutorial.
Hosted on docs.rs
Or build locally with:
cargo doc --open
Located in crates/extension-demo
A demo on writing R-extension with this, include a simple vector addition, matrix multiplication, and calling back a closure passed from R with additional arguments.
Located in crates/embedded-demo
A demo on embedding R in Rust, and using R from a pure Rust program.
Joke project and also serves as a testbed for the stability of this library.
Inline assembler for R.
cd crates/rasm
cargo build [--release]
# run demo
# please excuse the crudity of this model.
# I didn't have time to build it to scale or paint it.
cd demo
Rscript --no-save fork.R
Rscript --no-save sabotage.R