safe.uniroot | R Documentation |
Internal-use wrapper for catching errors induced by stats::uniroot
safe.uniroot(f = NULL, interval = NULL)
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 |
If no error occurs, returns the solved root. If an error occurs, output a custom message.
f <- function(x) x - 3
safe.uniroot(f, c(-10, 10))$root
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.