Node:Methods of Robj type, Next:, Previous:Calling R objects, Up:Robj type



Methods of Robj type

An object of type Robj has two methods:

as_py([mode])
This method forces the conversion of a Robj object to a classical Python object, whenever possible. If it is not possible, the same object is returned. The optional parameter is the mode from which to apply the conversion, see Modes. The default value for this parameter is the global mode (see R to Python).
autoconvert([mode])
local_mode([mode])
This method sets the local conversion mode for each object, which is used when the default mode is set to NO_DEFAULT, (see Python to R). When no argument is passed to this method, it displays the current local conversion mode of the object. (The two names are synonym for compatibility with version 0.1.)

For example:

>>> r.seq.local_mode(NO_CONVERSION)
>>> a = r.seq(3, 5)
>>> a
<Robj object at 0x814c2e8>
>>> a.as_py()
[3, 4, 5]