unique_by: Efficiently Extract Unique Elements from a Data Frame

Description Usage Arguments Details Value Examples

View source: R/unique_by.R

Description

Efficiently Extract Unique Elements from a Data Frame

Usage

1

Arguments

x

A base::data.frame

by

The column, as an integer or by name, to be used to split up x in chunks. If NA (default), then the first factor, string, or integer column will be used. If neither type exists, then the first column will be used.

...

Additional arguments passed to base::unique per chunk.

Details

unique_by(x) is typically more memory efficient than unique(x).

Value

A base::data.frame with duplicated rows drop.

Examples

1
2
3
iris1 <- unique(datasets::iris)
iris2 <- unique_by(datasets::iris, by = "Species")
stopifnot(identical(iris2, iris1))

HenrikBengtsson/TopDomStudy documentation built on May 14, 2021, 1:49 p.m.