asDiscrete

fun asDiscrete(variable: String, label: String? = null, orderBy: String? = null, order: Int? = null, levels: List<Any>? = null): MappingMeta

Marks a numeric variable as categorical. The plot will use a discrete scale for the aesthetic mapping. It is similar to the factor() function from R but works differently - there is no data transformation.

See also as_discrete.md.

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).

orderBy

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.