Description Usage Arguments Details Value
R has good foreign function interface bindings to C code. As such,
certain package authors may wish to optimize their code by keeping
their objects in C structures instead of R SEXPs (the standard for
object representation in the R interpreter). This also applies
to bindings to external libraries. The speed advantage can be
substantial, so this is not an uncommon use case. The s3normalize
helper provides the ability to add an additional "preprocessor"
layer prior to storing an object to S3 that converts a non-serializable
object (such as a list with one of its entries pointing to an
external C structure) to serialize object (such as that list with
its C structure pointer entry replaced by a raw
vector).
1 | s3normalize(object, read = TRUE)
|
object |
ANY. The R object to normalize. If it has an
|
read |
logical. If |
If the object being uploaded with s3store
or downloaded wiht
s3read
has an attribute "s3mpi.serialize"
which must
be a list with keys c("read", "write")
, these keys should
hold functions requiring a single argument which are applied to
the object prior to reading from (s3read
) and writing
to (s3store
) S3, respectively. This allows s3mpi storage
of not only vanilla R objects but arbitrary objects in memory
(whether they are internally represented by a C, Rust, Java, etc. process).
A previously possibly non-vanilla R object (that is,
an R object that may contain external pointers to non-R objects,
such as vanilla C structs) converted to a totally vanilla R object
(for example, by replacing the pointers with raw
binary data).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.