distinct_dt: Select distinct/unique rows in data.frame

Description Usage Arguments Value See Also Examples

View source: R/distinct_dt.R

Description

Analogous function for distinct in dplyr

Usage

1
distinct_dt(data, ..., .keep_all = FALSE)

Arguments

data

data.frame

...

Optional variables to use when determining uniqueness. If there are multiple rows for a given combination of inputs, only the first row will be preserved. If omitted, will use all variables.

.keep_all

If TRUE, keep all variables in data.frame. If a combination of ... is not distinct, this keeps the first row of values.

Value

data.table

See Also

distinct

Examples

1
2
3
4
5
iris %>% distinct_dt()
iris %>% distinct_dt(Species)
iris %>% distinct_dt(Species,.keep_all = TRUE)
mtcars %>% distinct_dt(cyl,vs)
mtcars %>% distinct_dt(cyl,vs,.keep_all = TRUE)

hope-data-science/tidydt documentation built on Feb. 21, 2020, 10:25 a.m.