safe.uniroot: Internal-use wrapper for catching errors induced by...

View source: R/safe.uniroot.R

safe.unirootR 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

powertools documentation built on June 10, 2025, 5:13 p.m.