Returns a categorical variable based on the values in the given collection.
Equivalent to R's factor function.
Options:
:data (default nil) factors will be extracted from the given data.
:ordered? (default false) indicates that the variable is ordinal.
:labels (default (sort (into #{} data)))
:levels (range (count labels))
Examples:
(categorical-var :data [:a :a :c :b :a :c :c])
(categorical-var :labels [:a :b :c])
(categorical-var :labels [:a :b :c] :levels [10 20 30])
(categorical-var :levels [1 2 3])
Comments top
No comments for categorical-var. Log in to add a comment.