safe.uniroot {powertools}R Documentation

Internal-use wrapper for catching errors induced by stats::uniroot

Description

Internal-use wrapper for catching errors induced by stats::uniroot

Usage

safe.uniroot(f = NULL, interval = NULL)

Arguments

f

The function for which the root is sought

interval

A vector containing the end-points of the interval to be searched for the root

Value

If no error occurs, returns the solved root. If an error occurs, output a custom message.

Examples

f <- function(x) x - 3
safe.uniroot(f, c(-10, 10))$root

[Package powertools version 0.1.3 Index]