Learn R Programming

RProtoBuf (version 0.4.2)

serialize_pb: Serialize R object to Protocol Buffer Message.

Description

This function serializes R objects to a general purpose protobuf message. It uses the same rexp.proto descriptor and mapping between R objects and protobuf messages as RHIPE.

Usage

serialize_pb(object, connection, ...)

Arguments

object
R object to serialize
connection
passed on to serialize
...
additional arguments passed on to serialize

Details

Third party clients need both the message and the rexp.proto descriptor to read serialized R objects. The latter is included in the the package installation proto directory: system.file(package="RProtoBuf", "proto/rexp.proto")

Currently, the following storage types are supported: character, raw, double, complex, integer, list, and NULL. Objects with other storage types, such as functions, environments, S4 classes, etc, will be skipped with a warning. Missing values, attributes and numeric precision will be preserved.

Examples

Run this code
msg <- tempfile();
serialize_pb(iris, msg);
obj <- unserialize_pb(msg);
identical(iris, obj);

Run the code above in your browser using DataLab