Skip to main content

builtin_factor

Function builtin_factor 

Source
fn builtin_factor(
    args: &[RValue],
    named: &[(String, RValue)],
) -> Result<RValue, RError>
Expand description

Encode a vector as a factor (categorical variable).

@param x vector to encode @param levels character vector of allowed levels (default: sorted unique values) @param labels character vector of display labels for the levels (default: same as levels) @param ordered if TRUE, create an ordered factor @return an integer vector with “levels” and “class” attributes