by_sim: Map a function simulation-wise

Description Usage Arguments

View source: R/functional-by-sim.R

Description

by_sim() is similar to apply() in that it applies a function .f to the margins of an array. by_sim() is specialised to apply the function on each simulation of a sims_array. It can be also be applied to a list of simulations, in which case .f may depend on several parameters.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
by_sim(.x, .f, ..., .context = list(), .bindings = NULL)

## S3 method for class 'list'
by_sim(.x, .f, ..., .context = list(), .bindings = NULL)

## S3 method for class 'sims'
by_sim(.x, .f, ..., .context = list(), .bindings = NULL)

## S3 method for class 'sims_array'
by_sim(.x, .f, ..., .context = list(), .sims = list(),
  .bindings = NULL)

Arguments

.x

A list of simulations arrays, or a simulations array.

.f

A function or an expression to be applied to each simulation.

...

Further arguments passed on to .f.

.context

A list or a data frame that contains additional variables used in .f.

.bindings

A named vector linking the arguments of .f to the names of the simulations arrays in .x, in case they do not match.

.sims

A list of simulations arrays containing additional parameters on which .statistic depends.


lionel-/gsim documentation built on May 21, 2019, 6:41 a.m.