Skip to main content

Module s4_helpers

Module s4_helpers 

Source
Expand description

S4 slot access and class checking helpers.

For new packages, S7 is the recommended class system (use #[miniextendr(s7)]). These S4 helpers exist for interoperating with existing S4 packages — for example, reading slots from Bioconductor objects passed as function arguments.

Since R’s C API for S4 slot access (R_has_slot, R_do_slot, R_do_slot_assign) is not exposed in miniextendr’s FFI bindings, these helpers use R expression evaluation via RCall as a fallback.

All functions require being called from the R main thread and operate

Functions§

methods_namespace 🔒
Get the methods package namespace for evaluating S4 functions.
s4_class_name
Extract the S4 class name from an object.
s4_get_slot
Get the value of a named slot from an S4 object.
s4_has_slot
Check if an S4 object has a named slot.
s4_is
Check if a SEXP is an S4 object.
s4_set_slot
Set the value of a named slot on an S4 object.
scalar_string 🔒
Create a scalar R character string from a Rust &str.