serialize_pb {RProtoBuf} | R Documentation |
Serialize R object to Protocol Buffer Message.
Description
Serializes R objects to a general purpose protobuf message using the same
rexp.proto
descriptor and mapping between R objects and protobuf
mesages as RHIPE.
Usage
serialize_pb(object, connection, ...)
Arguments
object |
R object to serialize |
connection |
passed on to |
... |
additional arguments passed on to |
Details
Clients need both the message and the rexp.proto
descriptor to parse
serialized R objects. The latter is included in the the package installation
proto
directory: system.file(package="RProtoBuf", "proto/rexp.proto")
The following storage types are natively supported by the descriptor:
character
, raw
, double
, complex
, integer
,
list
, and NULL
. Objects with other storage types, such as
functions, environments, S4 classes, etc, are serialized using base R
serialize
and stored in the proto native
type.
Missing values, attributes and numeric precision will be preserved.
Examples
msg <- tempfile();
serialize_pb(iris, msg);
obj <- unserialize_pb(msg);
identical(iris, obj);