Skip to content

Extend uniqueN to speed up for factors as well #2703

@MichaelChirico

Description

@MichaelChirico

I think the key insight of #2648 (optimizing uniqueN for logical input) was: we know in advance the output of uniqueN can only take on a small number of values (namely, NA, TRUE, or FALSE).

This logic should extend easily to factor columns as well, where we know the maximum possible uniqueN(factor_col) is length(levels(factor_col)) (+1 if !na.rm).

This is probably related to #2458, as well as #1120.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions