Skip to contents

Loads an object of class rjuliabugs from an .rds file and restores the corresponding Julia sampler object using Julia’s Serialization.deserialize. The path linking the Chains object from Julia is defined in the when the function save_rjuliabugs() is called.

Usage

load_rjuliabugs(file)

Arguments

file

A character string giving the path to the .rds file.

Value

An object of class rjuliabugs, with the Julia sampler object loaded into the current session. If the name was changed to avoid conflict, the returned object reflects the updated name.

Details

If the original sampler name (name) already exists in the active Julia session, a new unique name is generated to avoid overwriting it. A warning will be issued to indicate that the name has changed.

The .rds file must contain a valid rjuliabugs object with both the name and chains_file fields defined. The function checks if the sampler name is already defined in Julia. If so, a unique name is generated using check_sampler_is_defined, and the Julia object is loaded under that name.

Examples

if (FALSE) { # \dontrun{
model <- load_rjuliabugs("my_model.rds")
# model$name now contains the (possibly updated) name used in Julia
} # }