load_proposal: Load Stored Proposal

View source: R/proposal_info.R

load_proposalR Documentation

Load Stored Proposal

Description

This function loads a proposal into memory that was previously saved using the save_proposal() function. It is useful for retrieving saved proposals for further analysis or processing.

Usage

load_proposal(proposal_name)

Arguments

proposal_name

A string specifying the name of the proposal to be loaded.

Value

Returns a list representing the proposal stored under proposal_name in R's internal data directory. If the proposal corresponding to the specified name does not exist, an error message is displayed.

Examples

# First, let's create a proposal to sample from a standard normal distribution
f_normal <- function(x) { 0.3989423 * exp(-0.5 * x^2) }
normal_proposal = build_proposal(f = f_normal, modes = 0, lower = -Inf, upper = Inf, steps = 1000)
print(normal_proposal)

# Then, save this proposal in R's internal data directory using
# `save_proposal()` with the name "normal"
save_proposal(normal_proposal, "normal")

# Now, in case the R session is restarted and the proposal is no longer in memory,
# it can be loaded from the machine as follows:
loaded_normal_proposal <- load_proposal("normal")
print(loaded_normal_proposal)

stors documentation built on April 3, 2025, 6:16 p.m.