View source: R/proposal_info.R
save_proposal | R Documentation |
This function stores proposals generated by the build_proposal()
function in R's internal data directory. It is useful when users want to reuse a proposal across multiple R sessions.
save_proposal(proposal, proposal_name)
proposal |
list representing an optimized proposal generated using the |
proposal_name |
string specifying the name under which the proposal will be saved. |
This function will produce an error if the proposal is not generated by the build_proposal()
function. Otherwise, it successfully saves the proposal without returning any value upon completion.
# 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, we can save this proposal in R's internal data directory using `save_proposal()`
# with the name "normal"
save_proposal(normal_proposal, "normal")
# To make sure the `normal_proposal` has been stored in R's internal data directory,
# we can print all saved proposals using `print_proposals()`
print_proposals()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.