Description Usage Arguments See Also Examples
View source: R/recording_function.R
Return a new function which is identical to the soofunction
passed in except that evaluated parameter settings and function
values are recorded.
| 1 | recording_function(fn, record_pars = TRUE, record_values = TRUE, predicate)
 | 
| fn | A test function (class  | 
| record_pars | [ | 
| record_values | [ | 
| predicate | [ | 
recorded_values to retrieve the recorded
parameter and function values.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | fn <- recording_function(generate_sphere_function(2))
X <- random_parameters(10, fn)
y <- fn(X)
rv <- recorded_values(fn)
all.equal(rv$par, X)
all.equal(rv$value, y)
## With a predicate
pv <- function(par, value, time)
  time %% 3 == 0
fn <- recording_function(generate_sphere_function(2), predicate=pv)
X <- random_parameters(10, fn)
y <- fn(X)
rv <- recorded_values(fn)
all(rv$time %% 3 == 0)
all.equal(rv$par, X[, rv$time])
all.equal(rv$value, y[rv$time])
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.