View source: R/proposal_info.R
load_proposal | R Documentation |
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.
load_proposal(proposal_name)
proposal_name |
A string specifying the name of the proposal to be loaded. |
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.
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.