R objects¶
The class rpy2.robjects.RObject
can represent any R object, although it will often
be used for objects without any more specific representation
in Python/rpy2 (such as Vector
,
functions.Function
, Environment
).
The class inherits from the lower-level
rpy2.rinterface.Sexp
and from rpy2.robjects.robject.RObjectMixin
, the later defining
higher-level methods for R objects to be shared by other higher-level
representations of R objects.
-
class
rpy2.robjects.robject.
RObjectMixin
[source]¶ Bases:
object
Class to provide methods common to all RObject instances.
-
rclass
¶ R class for the object, stored as an R string vector.
When setting the rclass, the new value will be:
wrapped in a Python tuple if a string (the R class
is a vector of strings, and this is made for convenience)
wrapped in a StrSexpVector
Note that when setting the class R may make a copy of the whole object (R is mostly a functional language). If this must be avoided, and if the number of parent classes before and after the change are compatible, the class name can be changed in-place by replacing vector elements.
-
slots
¶ Attributes of the underlying R object as a Python mapping.
The attributes can accessed and assigned by name (as if they were in a Python dict).
-
-
class
rpy2.robjects.
RObject
(sexp: Union[Sexp, _rinterface.SexpCapsule])[source]¶ Bases:
rpy2.robjects.robject.RObjectMixin
,rpy2.rinterface_lib.sexp.Sexp
Base class for all non-vector R objects.