| shard_share_hook | R Documentation |
S3 generic that allows classes to customize deep sharing behavior. Override this for your class to control which slots/elements are traversed, force sharing of small objects, or transform objects before traversal.
shard_share_hook(x, ctx)
## Default S3 method:
shard_share_hook(x, ctx)
x |
The object being traversed during deep sharing. |
ctx |
A context list containing:
|
A list with optional fields:
Character vector of S4 slot names to not traverse
Character vector of paths to not traverse
Character vector of paths to force share (ignore min_bytes)
Function(x) -> x to transform object before traversal
Return an empty list for default behavior (no customization).
shard_share_hook.MyModelClass <- function(x, ctx) {
list(
skip_slots = "cache",
force_share_paths = paste0(ctx$path, "@coefficients")
)
}
shard_share_hook.LazyData <- function(x, ctx) {
list(
rewrite = function(obj) {
obj$data <- as.matrix(obj$data)
obj
}
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.