serial_config | R Documentation |
Returns a serialization configuration, which may be set to perform custom
serialization and unserialization of normally non-exportable reference
objects, allowing these to be used seamlessly between different R sessions.
Once set by passing to the serial
argument of daemons()
, the functions
apply to all mirai requests for that compute profile.
serial_config(class, sfunc, ufunc)
class |
a character string (or vector) of the class of object custom
serialization functions are applied to, e.g. |
sfunc |
a function (or list of functions) that accepts a reference
object inheriting from |
ufunc |
a function (or list of functions) that accepts a raw vector and returns a reference object. |
This feature utilises the 'refhook' system of R native serialization.
A list comprising the configuration. This should be passed to the
serial
argument of daemons()
.
cfg <- serial_config("test_cls", function(x) serialize(x, NULL), unserialize)
cfg
cfg2 <- serial_config(
c("class_one", "class_two"),
list(function(x) serialize(x, NULL), function(x) serialize(x, NULL)),
list(unserialize, unserialize)
)
cfg2
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.