MyNixOS website logo
Description

'MsgPack' C++ Header Files and Interface Functions for R.

'MsgPack' header files are provided for use by R packages, along with the ability to access, create and alter 'MsgPack' objects directly from R. 'MsgPack' 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. This package provides headers from the 'msgpack-c' implementation for C and C++(11) for use by R, particularly 'Rcpp'. The included 'msgpack-c' headers are licensed under the Boost Software License (Version 1.0); the code added by this package as well the R integration are licensed under the GPL (>= 2). See the files 'COPYRIGHTS' and 'AUTHORS' for a full list of copyright holders and contributors to 'msgpack-c'.

RcppMsgPack Build Status License CRAN Dependencies Downloads

MsgPack Headers for R and interface functions

About

This package provides R with both the MessagePack (or MsgPack as a shorthand) header files, and the ability to access, create and alter MessagePack objects directly from R.

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.

Usage

C++ headers

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.

Interface functions

The functions msgpack_pack and 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_timestamp_encode and msgpack_timestamp_decode.

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.

flowchartA flowchart describing the conversion of R objects into msgpack objects and back.

For more information on msgpack types, see here.

Example:

x <- as.list(1:1e6)
x_packed <- msgpack_pack(x)
x_unpacked <- msgpack_unpack(x_packed)

Installation

The package is on CRAN and can be installed via a standard

install.packages("RcppMsgPack")

Pre-releases have been available via the ghrr drat repository:

drat::addRepo("ghrr")
install.packages("RcppMsgPack")

Status

The package currently includes the MessagePack headers version 2.1.5.

See Also

See the BH package for related (and also header-only) libraries from Boost, and the RcppRedis package for simple yet performant Redis support.

Bug Reports

The issue tracker can be used for bug reports or feature requests.

Author

Dirk Eddelbuettel and Travers Ching.

Acknowledgements

Special thanks to Xun Zhu.

License

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.

Metadata

Version

0.2.3

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows