Categorical data with n observations and R levels can typically be represented as two forms in R: a factor with length n, or an n by K indicator matrix with elements being 0 or 1. This function is to switch the form of a categorical object from one to the another.
switch_cat_repr(obj)categorical object in the another form.
an object representing categorical data, either a factor or an indicator matrix with each row representing an observation.