serialize_pb: Serialize R object to Protocol Buffer Message.

View source: R/serialize_pb.R

serialize_pbR 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 serialize

...

additional arguments passed on to serialize

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);


RProtoBuf documentation built on Nov. 3, 2022, 9:06 a.m.