partial {simdata}R Documentation

Define partial function

Description

Partial functions are useful to define marginal distributions based on additional parameters.

Usage

partial(f, ...)

Arguments

f

Function in two or more parameters.

...

Parameters to be held fixed for function f.

Details

This helper function stores passed arguments in a list, and stores this list in the environment of the returned function. Thus, it remembers the arguments that should be held fixed, such that the returned partial function now is a function with fewer arguments.

Value

Function object.

Examples

marginal <- partial(function(x, meanx) qnorm(x, meanx), meanx = 2)
marginal(0.5)


[Package simdata version 0.4.0 Index]