Learn R Programming

ggpmisc (version 0.6.0)

fail_safe_formula: Safely extract the formula from an object

Description

Safely extract the formula from an object

Usage

fail_safe_formula(fm, method.args = list(), verbose = TRUE)

Value

A named list with objects of class formula or NA as member(s).

Arguments

fm

Fitted model object or a call object.

method.args

List of arguments to check for the formula.

verbose

logical If TRUE message triggered if call to formula() fails.

Details

Method formula is not implemented for all fitted model objects, while the default method triggers an error and stops exectution. Function fail_safe_formula() wraps the call to formula() and handles the error conditions by attempting to extract the formula from a list of arguments. If this fails, it returns NA, with a message.