Learn R Programming

shard (version 0.1.0)

fetch: Fetch Data from a Shared Object

Description

Retrieves the R object from shared memory by deserializing it. This is the primary way to access shared data in workers.

Usage

fetch(x, ...)

# S3 method for shard_shared fetch(x, ...)

# S3 method for shard_deep_shared fetch(x, ...)

# S3 method for default fetch(x, ...)

Value

The original R object that was shared.

Arguments

x

A shard_shared object.

...

Ignored.

Details

When called in the main process, this reads from the existing segment. When called in a worker process, this opens the segment by path and deserializes the data.

The fetch() function is the primary way to access shared data. It can also be called as materialize() for compatibility.

Examples

Run this code
# \donttest{
x <- 1:100
shared <- share(x)
recovered <- fetch(shared)
identical(x, recovered)
close(shared)
# }

Run the code above in your browser using DataLab