switch_cat_repr {semidist}R Documentation

Switch the representation of a categorical object

Description

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.

Usage

switch_cat_repr(obj)

Arguments

obj

an object representing categorical data, either a factor or an indicator matrix with each row representing an observation.

Value

categorical object in the another form.


[Package semidist version 0.1.0 Index]