as Discrete
fun asDiscrete(variable: String, label: String? = null, orderBy: String? = null, order: Int? = null, levels: List<Any>? = null): MappingMeta
The function converts a column to a discrete scale and allows you to specify the order of its values. It is similar to the factor()
function from R but works differently - there is no data transformation.
See also Working with Categorical Variables.
Examples
Parameters
variable
Name of the variable.
label
Name of the scale to be used as the axis label or the legend title (the default is the variable name).
order By
The variable name by which the ordering will be performed.
order
Ordering direction: 1 for ascending direction and -1 for descending.
levels
The list of values that defines a specific order of categories.