SimpleConverter#

class SimpleConverter(constructor_dict=DEFAULT_CLASS_MAP, *, default_encoding=None, force_default_encoding=False, global_environment=None, base_environment=None)[source]#

Class converting R objects to Python objects.

Parameters:
  • constructor_dict (ConstructorDict) –

    Dictionary mapping names of R classes to constructor functions with the following prototype:

    def constructor(obj, attrs):
        ...
    

    This dictionary can be used to support custom R classes. By default, the dictionary used is DEFAULT_CLASS_MAP which has support for several common classes.

  • default_encoding (str | None) – Default encoding used for strings with unknown encoding. If None, the one stored in the file will be used, or ASCII as a fallback.

  • force_default_encoding (bool) – Use the default encoding even if the strings specify other encoding.

  • global_environment (MutableMapping[str, Any] | None) – Global environment to use. By default is an empty environment.

  • base_environment (MutableMapping[str, Any] | None) – Base environment to use. By default is an empty environment.

Methods

convert(data)

Convert a R object to a Python one.

convert(data)[source]#

Convert a R object to a Python one.

Parameters:

data (parser.RData | parser.RObject)

Return type:

Any