validate_formula: Validate Formula Variables

View source: R/validate.R

validate_formulaR Documentation

Validate Formula Variables

Description

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.

Usage

validate_formula(
  formula,
  data = NULL,
  func_name = "function",
  calling_env = parent.frame()
)

Arguments

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().

Value

Returns NULL invisibly. Stops with an error if validation fails.


statuser documentation built on April 25, 2026, 5:06 p.m.