Functions like integrate() and nlm() return objects that contain more information that simply the value of the integration or optimization. value() extracts the primary value from such objects. Currently implemented situations include the output from integrate(), nlm(), cubature::adaptIntegrate(), and uniroot().

value(object, ...)

# S3 method for integrate
value(object, ...)

# S3 method for default
value(object, ...)

Arguments

object

an object from which a "value" is to be extracted.

...

additional arguments (currently ignored).

Examples

integrate(sin, 0, 1) |> value()
#> [1] 0.4596977
nlm(cos, p = 0) |> value()
#> [1] 0
uniroot(cos, c(0, 2)) |> value()
#> [1] 1.570784