Validates inputs for plotting functions that accept either formula syntax (y ~ group) or standard syntax (y, group), with optional data frame.
validate_plot(
y,
group = NULL,
data = NULL,
func_name = "plot",
require_group = TRUE,
data_name = NULL
)A list containing:
y: Validated y variable (numeric vector)
group: Validated group variable (if provided, otherwise NULL)
y_name: Clean variable name for y (for labels)
group_name: Clean variable name for group (for labels)
y_name_raw: Raw variable name for y (for error messages)
group_name_raw: Raw variable name for group (for error messages)
data_name: Name of data argument (for error messages)
A numeric vector, column name, or formula of the form y ~ group.
A vector used to group the data, or a column name if data is provided. Can be NULL for functions where group is optional.
An optional data frame containing the variables.
Character string. Name of the calling function (for error messages).
Logical. If TRUE, group is required. If FALSE, group can be NULL.
Character string. Name of the data argument (for error messages). If NULL, will attempt to infer from the call.