Clean and validate facet dimension value for lineplot module
Source:R/plot_facets.R
clean_facet_dim.RdInternal helper function that validates and sanitizes a numeric
value intended for use as a facet dimension (rows or columns) in a
ggplot2 faceting layout. Ensures the value is a positive numeric
greater than or equal to 1, returning NULL for invalid inputs to
gracefully handle missing or malformed facet specifications.
Details
This function is used within VizModules lineplot functions to
process user-supplied facet dimensions before passing to facet_grid() or
facet_wrap(). Invalid values trigger sensible defaults rather than
breaking the plot layout.
Valid inputs return unchanged. Invalid inputs (NULL, NA, non-numeric,
< 1) return NULL.