View source: R/GenMonteCarloSamples.R
GenMonteCarloSamples | R Documentation |
GenMonteCarloSamples
returns a list of samples from executing the function
with arguments
GenMonteCarloSamples(calc, calc_args, iterations = 100)
calc |
A function to sample |
calc_args |
A function to create arguments for the func being sampled |
iterations |
The number of samples to create |
samples The return values from the calc function
calc_estimate <- function(a, ef) {
return(a * ef)
}
calc_args <- function() {
area <- 10
emission_factor <- rtriangle(
n = 1, theta = ef_defor,
lower = ef_defor_lci,
upper = ef_defor_uci
)
return(list(area, emission_factor))
}
GenMonteCarloSamples(calc_estimate, calc_args, 1000) # returns object
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.