RDataTypeRegister[type,fwpatt,fwrule,bckpatt,bckrule] registers a new Wolfram Language representation for a data type with name type.
- The type argument should normally be a string.
- Expressions matching the fwpatt pattern will be considered by RLink to be of type type.
- The rule fwrule instructs RLink how to convert the new Wolfram Language representation to representation based on RObject.
- The bckpatt pattern identifies types of expressions based on RObject that RLink considers to represent objects of type type.
- The rule bckrule instructs RLink how to convert such expressions to a more convenient, higher-level Wolfram Language representation defined with RDataTypeRegister.
- If the type with the name type has already been registered, RDataTypeRegister returns $Failed.
You can test that the definition is now effective by using ToRForm:
Now the following will get back the usual representation based on RObject: