Description Usage Arguments Details Value Examples
unpackMsg
converts a raw array containing one message in msgpack
format into the corresponding R data structure.
unpackMsgs
extracts a number of msgpack messages from a raw object.
unpackOpts()
interprets is passed to ...
in unpackMsgs()
,
unpackMsg()
, and msgConnection()
. It is not exported.
1 2 3 4 5 6 |
x |
A |
... |
Options passed to unpackOpts. |
n |
How many messages to read. An "NA" here means to read as much as possible. |
reader |
For implementing connections; a function that takes no arguments and returns a raw containing more data. |
parent |
When an environment is given, (such as |
df |
When |
simplify |
If |
max_size |
The maximum length of message to decode. |
max_depth |
The maximum degree of nesting to support. |
underflow_handler |
Used internally. |
The msgpack format does not have typed arrays, so all msgpack
arrays are effectively lists from the R perspective. However, if an
array containing compatibly typed elements is read, unpack
will
return a logical, integer, real or string vector as
appropriate. This behavior is disabled with simplify=FALSE
. The
coercion used is more conservative than R's coercion: Integer
values may be converted to real, but boolean values will not be
cast to numeric, nor any types to string. If conversion from a
large integer to real loses precision, a warning is printed.
Msgpack also does not distinguish between NA
and NULL
. All nils
will be decoded as NA.
Strings are assumed to be UTF-8 encoded. If a msgpack string does not appear to be valid UTF-8, a warning is printed and a raw object is produced instead.
Msgpack allows any type to be the key of a dict, but R only
supports strings. If a non-string appears as key in a msgpack dict,
it will be converted to string with deparse()
.
Extension types will be decoded as raw objects with a class like
"ext120"
and a warning.
unpackMsg(x)
returns one decoded message (which might be
shorter than the input raw), or throws an error.
unpackMsgs(r, n)
returns a list X
with four elements:
X$msgs
is a list of the messages unpacked.
X$remaining
is data remaining to be parsed.
X$status
is a status message, typically "ok", "end of input",
or "buffer underflow".
x$bytes_read
the number of bytes consumed.
1 2 3 4 5 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.