| validate_formula | R Documentation |
Checks if the input is a formula and validates that all variables mentioned in the formula exist either in the provided data frame or in the environment. This is a lightweight validation function that should be called early in functions that accept formula syntax.
validate_formula(
formula,
data = NULL,
func_name = "function",
calling_env = parent.frame()
)
formula |
A potential formula object to validate (can be any object). |
data |
An optional data frame containing the variables. |
func_name |
Character string. Name of the calling function (for error messages). |
calling_env |
The environment in which to look for variables if data is not provided. Defaults to parent.frame(). |
Returns NULL invisibly. Stops with an error if validation fails.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.