Helper function to drop unused levels from a factor variable while preserving
the label attribute. The base R droplevels() function strips all attributes
except levels and class, which causes the loss of variable labels that are
commonly used in clinical trial datasets.
.drop_levels_keep_label(x)The input factor with unused levels dropped and the label attribute preserved.
(factor) A factor variable, potentially with a label attribute.