Description Usage Arguments Details Value Methods (by class) References
The XR structure requires a server-language function objectFromJSON()
which
parses an object description in JSON. Methods for generic function objectAsJSON()
should produce the appropriate string.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | objectAsJSON(object, prototype = prototypeObject(), level = 1)
## S4 method for signature 'array'
objectAsJSON(object, prototype = prototypeObject(),
level = 1)
## S4 method for signature 'environment'
objectAsJSON(object, prototype = prototypeObject(),
level = 1)
## S4 method for signature 'list'
objectAsJSON(object, prototype = prototypeObject(),
level = 1)
## S4 method for signature 'envRefClass'
objectAsJSON(object, prototype = prototypeObject(),
level = 1)
## S4 method for signature 'Interface'
objectAsJSON(object, prototype = prototypeObject(),
level = 1)
## S4 method for signature 'AssignedProxy'
objectAsJSON(object, prototype = prototypeObject(),
level = 1)
## S4 method for signature 'ProxyClassObject'
objectAsJSON(object,
prototype = prototypeObject(), level = 1)
|
object |
The object to be converted. |
prototype |
The prototype server class; see |
level |
Will be 1 for top-level call, incremented when recalled for an element. Used to make choices about scalars. |
This function is typically called from a method for asServerObject
.
Methods for objectAsJSON()
in turn often call one or both of two helper functions:
asJSONS4()
, which produces the full description of the R object; and
typeToJSON()
, which produces the code for the basic R types, ignoring all
class or attribute information.
A string that will be parsed according to JSON grammar.
array
: treat matrix and array objects as legitimate S3 objects
environment
: An environment is encoded with its class, in contrast to a named list
which may be a simple dictionary.
list
: A list will be encoded as a JSON list if it has no names, as a JSON
dictionary if it has all distinct, non-empty names, or with an explicit representation in
all other cases.
envRefClass
: An explicit representation that includes the fields.
Interface
: An interface object is transmitted via its character string Id,
enough to identify the object; the rest is too R-dependent to be useful.
AssignedProxy
: Gets the object back from the server, then recalls the generic.
It's usually not a good idea to get here, because bringing the proxy back and then converting
it again is not foolproof; better to make direct use of the proxy. But if a proxy object
is part of an ordinary list, environment or other R object, this method will be used.
ProxyClassObject
: Gets the object back from the server, then recalls the generic.
See the comments under the "AssignedProxy"
method.
Chambers, John M. (2016) Extending R, Chapman & Hall/CRC. ( Chapter 13, discussing this package, is included in the package: ../doc/Chapter_XR.pdf.)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.