asRObject: Specialize the R Object Returned from an Interface Evaluator

Description Usage Arguments Details Methods (by class) Writing Application Methods References

Description

The result of a server language expression is returned as a string, using the JSON standard notation to represent a scalar, list or dictionary. Methods for this function get the simple R object obtained from deparsing and interpret it generally.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
asRObject(object, evaluator)

## S4 method for signature 'ProxyObject'
asRObject(object, evaluator)

## S4 method for signature 'vector_R'
asRObject(object, evaluator)

## S4 method for signature 'list'
asRObject(object, evaluator)

## S4 method for signature 'data.frame'
asRObject(object, evaluator)

Arguments

object

An object constructed from the explicit representation as a dictionary. The elements of the dictionary will be converted into objects for the slots of the same name. Application-written methods will re-interpret the object into the intended R form, not necessarily from the same class.

evaluator

This argument will be supplied as the evaluator object doing the conversion. Therefore, methods may have one of the specific evaluator classes (e.g., "PythonInterface", in their signature.

Details

The methods supplied with the 'XR' pacakage handle the standard mechanisms for interpretation. Additional methods are likely to interpret proxy class objects for which the standard XR representation in terms of class and slots is not what's actually wanted.

Methods (by class)

Writing Application Methods

Application packages will typically write methods for special classes, and often for classes themselves defined in the package. One good reason is that the server language does not naturally return the eventually intended object in a convenient form; for example, because it does not have typed arrays. Then a special class will be defined in R. The server code will generate a dictionary with the ".RClass" element having the class name, plus whatever slots make sense. The application method for asRObject() will take these slots and construct whatever object is really intended. For an example, see the method for class vector_R.

References

Chambers, John M. (2016) Extending R, Chapman & Hall/CRC. ( Chapter 13, discussing this package, is included in the package: ../doc/Chapter_XR.pdf.)


XR documentation built on Nov. 17, 2017, 6:55 a.m.

Related to asRObject in XR...