slotOp {base}R Documentation

Extract or Replace A Slot


Extract or replace the contents of a slot in a object with a formal (S4) class structure.


object@name <- value



An object from a formally defined (S4) class.


The character-string name of the slot, quoted or not. Must be the name of a slot in the definition of the class of object.


A replacement value for the slot, which must be from a class compatible with the class defined for this slot in the definition of the class of object.


These operators support the formal classes of package methods, and are enabled only when package methods is loaded (as per default). See slot for further details, in particular for the differences between slot() and the @ operator.

It is checked that object is an S4 object (see isS4), and it is an error to attempt to use @ on any other object. (There is an exception for name .Data for internal use only.) The replacement operator checks that the slot already exists on the object (which it should if the object is really from the class it claims to be).

Prior to R 3.0.0 the replacement operator was in package methods and had a different test for validity of name.

These are internal generic operators: see InternalMethods.


The current contents of the slot.

See Also

Extract, slot

[Package base version 3.2.2 Index]