Scans a data frame and returns the names of columns that are appropriate
choices for a facet/split selector. A column qualifies when it is
categorical (character or factor) and has fewer than max.levels unique
values. This keeps facet/split inputs from offering numeric columns or
high-cardinality categoricals that would produce an unwieldy number of
panels. The modules also use it, through discrete_choices(), to limit their
categorical colour, shape and group selectors, where a column of IDs would
otherwise ask for one colour or shape per row.
Value
A character vector of column names suitable for faceting/splitting.
Returns character(0) when no column qualifies.
Details
Intended to populate the choices of a facet/split viz_select_input() via
update_viz_select() inside a module server, so that only sensible
faceting variables are exposed to the user.
A column is considered valid when both of the following hold:
It is categorical:
is.character(col)oris.factor(col).It has fewer than
max.levelsunique values (NAs excluded).
Numeric columns and categorical columns with max.levels or more
distinct values are always excluded.