Safely extract the formula from an object
fail_safe_formula(fm, method.args = list(), verbose = TRUE)
A named list with objects of class formula or NA as member(s).
Fitted model object or a call object.
List of arguments to check for the formula.
logical If TRUE
message triggered if call to
formula()
fails.
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.