MsgPack Headers for R and interface functions
MessagePack is an efficient binary serialization format.
It lets you exchange data among multiple languages like JSON. But it is faster and smaller. Small integers are encoded into a single byte, and typical short strings require only one extra byte in addition to the strings themselves. MessagePack is used by Redis and many other projects.
To use the headers from this package, simply add it to the
LinkingTo: field in the
DESCRIPTION field of your R package---and the R package infrastructure tools will then
know how to set include flags correctly on all architectures supported by R.
msgpack_unpack allow you to serialize and de-serialize R objects respectively.
msgpack_format is a helper function to properly format R objects for input.
msgpack_simplify is a helper function to simplify output from MsgPack conversion.
MsgPack EXT types are converted to raw vectors with EXT attributes containing the extension type. The extension type must be an integer from 0 to 127. MsgPack Timestamps are an EXT with type -1. Timestamps can be encoded and decoded from
POSIXct objects in R to MsgPack format with
Msgpack Maps are converted to data.frames with additional class "map". Map objects in R contain key and value list columns and can be simplified to named lists or named vectors. The helper function
msgpack_map creates map objects that can be serialized into msgpack.
For more information on msgpack types, see here.
x <- as.list(1:1e6) x_packed <- msgpack_pack(x) x_unpacked <- msgpack_unpack(x_packed)
The package is on CRAN and can be installed via a standard
Pre-releases have been available via the ghrr drat repository:
The package currently includes the MessagePack headers version 2.1.5.
The issue tracker can be used for bug reports or feature requests.
Dirk Eddelbuettel and Travers Ching.
Special thanks to Xun Zhu.
The R package is provided under the GPL (version 2 or later). The included MsgPack library is released under the same license as Boost, the BSL-1.0.