nor1mix (version 1.3-0)

norMix2call: Transform "norMix" object into Call, Expression or Function

Description

E.g., for taking symbolic derivatives, it may be useful to get an R call, expression, or function in / of x from a specific "norMix" object.

Usage

norMix2call(obj, oneArg = TRUE)
# S3 method for norMix
as.expression(x, oneArg = TRUE, ...)
# S3 method for norMix
as.function  (x, oneArg = TRUE, envir = parent.frame(), ...)

Value

according to the function used, an R

‘language’ object, i.e., a

call, expression, or function, respectively.

Arguments

obj, x

an R object of class "norMix".

oneArg

logical specifying if expressions of the form dnorm((x - mu)/sig) should be used, i.e. one Argument only, instead of dnorm(x, mu, sig).

envir

an environment; often the default is perfect.

...

potentially further arguments (not used in any examples yet).

Author

Martin Maechler

See Also

norMix. Note that deriv() currently only works correctly in case of the default oneArg = TRUE.

Examples

Run this code
(cMW2 <- norMix2call(MW.nm2))
deriv(cMW2, "x")

(fMW1 <- as.function  (MW.nm1))
(eMW3 <- as.expression(MW.nm3))
stopifnot(is.call      (cMW2),  is.call(norMix2call(MW.nm2, FALSE)),
          is.function  (fMW1),  is.function  (as.function  (MW.nm4)),
          is.expression(eMW3),  is.expression(as.expression(MW.nm5))
)

Run the code above in your browser using DataCamp Workspace