The function factor is used to encode a value as a factor (the terms ‘category’ and ‘enumerated type’ are also used for factors). The factor levels are assumed to be ordered.
factor(
"Baby" =? {[age] ?| less-than(1)},
"Children" =? {[age] ?| less-than(12)},
"Teenager" =? {[age] ?| less-than(18)},
"Teenager" =? {{[age] ?| less-than(21)} |AND {[continent] ?| equivalent-to("America")}},
"Adult"
)
The function factor is used to encode a value as a factor (the terms ‘category’ and ‘enumerated type’ are also used for factors). The factor levels are assumed to be ordered.