Skip to main content

s4_set_slot

Function s4_set_slot 

Source
pub unsafe fn s4_set_slot(
    obj: SEXP,
    slot_name: &str,
    value: SEXP,
) -> Result<(), String>
Expand description

Set the value of a named slot on an S4 object.

Uses R’s slot(obj, name) <- value to assign the slot value.

§Safety

  • obj must be a valid S4 SEXP with the named slot.
  • value must be a valid SEXP of the appropriate type for the slot.
  • Must be called from the R main thread.

§Returns

  • Ok(()) on success.
  • Err(String) if the slot doesn’t exist or the value type is incompatible.