Helper Coercion Function to Factor with explicit missing levels

h_as_factor(x, na_label)

Arguments

x

(character or logical) input to be turned into factor with explicit missing level.

na_label

(character) the label to encode missing levels.

Details

This function preserves labels.