Default conversions#
This page list the default conversions applied to R objects to convert them to Python objects.
Basic types#
The conversion of basic types is performed directly by the
Converter
used.
Thus, changing the conversion for basic types currently requires creating a
custom Converter
class.
The default SimpleConverter
realizes the following
conversions:
R object type |
Python conversion |
---|---|
builtin function |
|
bytecode |
|
char (internal) |
|
closure |
|
complex |
|
environment |
|
expression |
|
external pointer |
|
integer |
|
language |
|
list |
|
logical (boolean) |
|
missing argument |
|
NULL |
|
real |
|
reference |
The referenced value, that is, an object already converted. |
S4 object |
|
special function |
|
string |
|
symbol |
|
vector |
|
Custom classes#
In addition, objects containing a “class” attribute are passed to a “constructor function”, if one is available. A dictionary of constructor functions can be supplied to the converter, where the key of each element corresponds to the class name. When the “class” attribute contains several class names, these are tried in order. The default constructor dictionary allows to convert the following R classes:
R class |
Python conversion |
---|---|
data.frame |
|
factor |
|
ordered |
|
srcfile |
|
srcfilecopy |
|
srcref |
|
ts |