factor_: Fast Factor Generation

Description Usage Arguments Details

View source: R/fast_factor.R

Description

This function generates factors more quickly, by leveraging fastmatch::fmatch.

Usage

1
factor_(x, levels = NULL, labels = levels, na.last = NA)

Arguments

x

An object of atomic type integer, numeric, character or logical.

levels

An optional character vector of levels. Is coerced to the same type as x. By default, we compute the levels as sort(unique.default(x)).

labels

A set of labels used to rename the levels, if desired.

na.last

If TRUE and there are missing values, the last level is set as NA; otherwise; they are removed.

Details

NaNs are converted to NA when used on numerics.


kevinushey/Kmisc documentation built on May 20, 2019, 9:08 a.m.